Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| EAC Toolkit 3.2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.endeca.soleng.eac.toolkit.base
Class Synchronizable

    java.lang.Object
      com.endeca.soleng.eac.toolkit.base.EacElement
          com.endeca.soleng.eac.toolkit.base.Synchronizable

Direct Known Subclasses:
  LockManager

    public abstract class Synchronizable

extends EacElement

Object from which all synchronized EAC objects extend. This class contains logic associated with accessing the EAC's synchronization service and implements methods for obtaining and releasing locks/flags.

Field Summary

Fields inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
`appName, dataPrefix, eacHost, eacPort, elementId, lockManager, logDir, sslEnabled, workingDir`

Constructor Summary
`Synchronizable()`

Method Summary
`boolean` | `isFlagSet(java.lang.String flagToTest)` Test whether the specified flag is set in the EAC.
`java.util.List<java.lang.String>` | `listFlags()` Retrieves a list of all flags set in the EAC for this application.
`void` | `removeFlag(java.lang.String flag)` Removes a flag in the EAC.
`boolean` | `setFlag(java.lang.String flag)` Sets a flag in the EAC.
`boolean` | `waitForFlagSet(java.lang.String flagToTest, long maxWaitSeconds)` Polls, waiting for the specified flag to be set.

Methods inherited from class com.endeca.soleng.eac.toolkit.base.EacElement
`getAppName, getDataPrefix, getEacHost, getEacPort, getElementId, getLockManager, getLogDir, getWorkingDir, isSslEnabled, setAppName, setDataPrefix, setEacHost, setEacPort, setElementId, setLockManager, setLogDir, setSslEnabled, setWorkingDir`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Synchronizable

    public Synchronizable()

Method Detail

### isFlagSet

    public boolean isFlagSet(java.lang.String flagToTest)

  Test whether the specified flag is set in the EAC. This method does not attempt to set or remove the flag and it is not expected that using this method to test the existence of a flag will be useful when using flags as a mutex. In fact, using this method when dealing with mutex/lock flags is dangerous, as it creates a race condition between this method's test and any following action. If flags are used as indicators, this method is useful for testing the existence of an indicator. For use as a mutex, flags should be set or removed (usually via the acquireLock and releaseLock methods in the LockManager object).

  Parameters:
    `flagToTest` - Name of the flag to test.
  Returns:
    True if the flag is set.

### listFlags

    public java.util.List<java.lang.String> listFlags()

  Retrieves a list of all flags set in the EAC for this application.

  Returns:
    Returns a list of Strings, representing the set EAC flags.

### waitForFlagSet

    public boolean waitForFlagSet(java.lang.String flagToTest,
                                  long maxWaitSeconds)

  Polls, waiting for the specified flag to be set. This method will test for the flag every second. If a maximum wait time is specified, this method will return fals when the flag is not set in the maximum time. As with the isFlagSet method, this method is not safe to use if flags are to be used as a mutex/lock.

  Parameters:
    `flagToTest` - Name of the flag to test.
    `maxWaitSeconds` - Maximum number of seconds to test for the flag.
  Returns:
    Returns true if the flag is set and false if time elapses before the flag is set.

### setFlag

    public boolean setFlag(java.lang.String flag)
                    throws EacCommunicationException,
                           EacSynchronizationException

  Sets a flag in the EAC. If the set fails (usually as a result of the flag already being set), this method returns false.

  Parameters:
    `flag` - Name of flag to set.
  Returns:
    Returns true if the flag is set successfully.
  Throws:
    `EacCommunicationException` - If a communication error occurs while retrieving the synchronization port.
    `EacSynchronizationException` - If an error occurs while setting the flag.

### removeFlag

    public void removeFlag(java.lang.String flag)
                    throws EacCommunicationException

  Removes a flag in the EAC.

  Parameters:
    `flag` - Name of flag to remove.
  Throws:
    `EacCommunicationException` - If a communication error occurs while retrieving the synchronization port.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| EAC Toolkit 3.2.2
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006, 2012, Oracle and/or its affiliates. All rights reserved.

    @VERSION
    PRODUCT: EAC Toolkit (eacToolkit)
    VERSION: 3.2.2
    BUILD:   NONEDEV
    ARCH_OS: n/a
    DATE:    2012-02-28T13:13:15-0500