Class SshSessionPool
java.lang.Object
org.qubership.atp.mia.repo.impl.pool.ssh.SshSessionPool
- All Implemented Interfaces:
ConnectionPool
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic int -
Constructor Summary
ConstructorsConstructorDescriptionSshSessionPool(String cleanTimeout, String keepAlive, MiaContext miaContext) Creates connection pool for SSH connections. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddTimeShiftSession(Server server, CommonConfiguration configuration) Adds SystemId and its time shift status, also creates/reopens session.voidInvalidates all free and not executing connection in cache (soft clean).voidRemoves all not time shifted entities (with false as a key).getConnection(Server server, String extPrefix) Checks if there is available connection in Cache.voidremoveTimeShiftSession(Server server) Removes and closes time shift session.void
-
Field Details
-
systemsForTimeShifting
-
KEEP_ALIVE_MSG_INTERVAL
public static int KEEP_ALIVE_MSG_INTERVAL
-
-
Constructor Details
-
SshSessionPool
public SshSessionPool(@Value("${ssh.close.delay:300}") String cleanTimeout, @Value("${db.server.keep.alive:30000}") String keepAlive, MiaContext miaContext) Creates connection pool for SSH connections. AftercleanTimeout(seconds) removes ssh connection from cache. Also everycleanTimeout(seconds) performs cleaning connections.- Parameters:
cleanTimeout- after this timeout in seconds cache will be
-
-
Method Details
-
addTimeShiftSession
Adds SystemId and its time shift status, also creates/reopens session. We avoid recreation of timeShift session on purpose, because establishing such connection requires readiness of both connection sides.- Parameters:
server- - with ssh server credentials.configuration- - configuration to configure keystore.
-
removeTimeShiftSession
Removes and closes time shift session.- Parameters:
server- - which session need to remove.
-
getConnection
Checks if there is available connection in Cache. If it is then returns already opened connection otherwise creates a new one and overrides old.- Specified by:
getConnectionin interfaceConnectionPool- Parameters:
server- - object with ssh server credentials.- Returns:
- SshConnectionManager which is ready to execute ssh commands.
-
cleanConnectionCache
public void cleanConnectionCache()Invalidates all free and not executing connection in cache (soft clean). -
cleanTimeShiftMap
public void cleanTimeShiftMap()Removes all not time shifted entities (with false as a key). -
resetCache
public void resetCache()- Specified by:
resetCachein interfaceConnectionPool
-