Class LaunchIdLockSocket
- java.lang.Object
-
- com.epam.reportportal.service.launch.lock.AbstractLaunchIdLock
-
- com.epam.reportportal.service.launch.lock.LaunchIdLockSocket
-
- All Implemented Interfaces:
LaunchIdLock
public class LaunchIdLockSocket extends AbstractLaunchIdLock
A service to perform blocking I/O operations on network sockets to get single launch UUID for multiple clients on a machine. This class uses local networking, therefore applicable in scope of a single hardware machine. You can control port number withListenerProperty.CLIENT_JOIN_LOCK_PORTproperty.
-
-
Field Summary
Fields Modifier and Type Field Description static java.nio.charset.CharsetTRANSFER_CHARSET-
Fields inherited from class com.epam.reportportal.service.launch.lock.AbstractLaunchIdLock
parameters
-
Fields inherited from interface com.epam.reportportal.service.LaunchIdLock
MAX_WAIT_TIME_DISCREPANCY
-
-
Constructor Summary
Constructors Constructor Description LaunchIdLockSocket(ListenerParameters listenerParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidfinishInstanceUuid(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.StringobtainLaunchUuid(java.lang.String uuid)Returns a Launch UUID for many Clients launched on one machine.voidupdateInstanceUuid(java.lang.String instanceUuid)Update self UUID in a lock, means that the Client still executing its Launch.
-
-
-
Constructor Detail
-
LaunchIdLockSocket
public LaunchIdLockSocket(ListenerParameters listenerParameters)
-
-
Method Detail
-
obtainLaunchUuid
public java.lang.String obtainLaunchUuid(@Nonnull java.lang.String uuid)Returns a Launch UUID for many Clients launched on one machine.- Parameters:
uuid- a Client instance UUID, which will be written to lock and sync files and, if it 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)Description copied from interface:LaunchIdLockUpdate self UUID in a lock, means that the Client still executing its Launch.- 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:LaunchIdLockReturn all instance UUIDs which are still running.- Returns:
- a collection of live instance UUIDs
-
-