Class LaunchIdLockFile

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void finishInstanceUuid​(java.lang.String instanceUuid)
      Remove self UUID from sync file, means that a client finished its Launch.
      java.util.Collection<java.lang.String> getLiveInstanceUuids()
      Return all instance UUIDs which are still running.
      java.lang.String obtainLaunchUuid​(java.lang.String instanceUuid)
      Returns a Launch UUID for many Clients launched on one machine.
      void updateInstanceUuid​(java.lang.String instanceUuid)
      Update timestamp for instance record in sync file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LOCK_FILE_CHARSET

        public static final java.nio.charset.Charset LOCK_FILE_CHARSET
    • Constructor Detail

      • LaunchIdLockFile

        public LaunchIdLockFile​(@Nonnull
                                ListenerParameters listenerParameters)
    • Method Detail

      • obtainLaunchUuid

        @Nullable
        public java.lang.String obtainLaunchUuid​(@Nonnull
                                                 java.lang.String instanceUuid)
        Returns a Launch UUID for many Clients launched on one machine.
        Parameters:
        instanceUuid - a Client instance UUID, which will be written to lock and sync files and, if it is the first thread which managed to obtain lock on '.lock' file, returned to every client instance.
        Returns:
        either a Client instance UUID, either the first UUID which thread managed to place a lock on a '.lock' file.
      • updateInstanceUuid

        public void updateInstanceUuid​(@Nonnull
                                       java.lang.String instanceUuid)
        Update timestamp for instance record in sync file.
        Parameters:
        instanceUuid - instanceUuid a Client instance UUID
      • finishInstanceUuid

        public void finishInstanceUuid​(@Nonnull
                                       java.lang.String instanceUuid)
        Remove self UUID from sync file, means that a client finished its Launch. If this is the last UUID in the sync file, lock and sync files will be removed.
        Parameters:
        instanceUuid - a Client instance UUID.
      • getLiveInstanceUuids

        @Nonnull
        public java.util.Collection<java.lang.String> getLiveInstanceUuids()
        Description copied from interface: LaunchIdLock
        Return all instance UUIDs which are still running.
        Returns:
        a collection of live instance UUIDs