private static int getPowershellHeight() { if ( _canPowershell ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "powershell.exe", "/c", "$host.UI.RawUI.WindowSize.Height" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canPowershell = false; } } return -1; }
private static int getPowershellWidth() { if ( _canPowershell ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "powershell.exe", "/c", "$host.UI.RawUI.WindowSize.Width" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canPowershell = false; } } return -1; }
/** * Tries to orderly shutdown ({@link ExecutorService#shutdown()}) all tasks * of an {@link ExecutorService}, after a given timeout in milliseconds, * shutdown is forced as of {@link ExecutorService#shutdownNow()}. * * No shutdown is forced in case a timeout of o is being provided. * ------------------------------------------------------------------------- * CAUTION: Do only invoke this methods on {@link ExecutorService} instances * you manage exclusively yourself, do not apply this method on * {@link ExecutorService} instances provided to you by your application * server (e.g. an JEE server). * ------------------------------------------------------------------------- * * @param aExecutorService The service which's threads are to be shut down * after the given timeout. * * @param aTimeOutInMs The timeout after which to force shutdown eventually, * in case 0 is being provided, then no shutdown is being forced (all * threads are executed till them terminate normally). */ public static void shutdownGracefully( ExecutorService aExecutorService, long aTimeOutInMs ) { aExecutorService.shutdown(); if ( aTimeOutInMs > 0 ) { try { aExecutorService.awaitTermination( DaemonLoopSleepTime.NORM.getMilliseconds(), TimeUnit.MILLISECONDS ); } catch ( InterruptedException ignored ) {} aExecutorService.shutdownNow(); } }
/** * Tries to orderly shutdown ({@link ExecutorService#shutdown()}) all tasks * of an {@link ExecutorService}, after a timeout of * {@link IoRetryCount#NORM} milliseconds, shutdown is forced as of * {@link ExecutorService#shutdownNow()}. * ------------------------------------------------------------------------- * CAUTION: Do only invoke this methods on {@link ExecutorService} instances * you manage exclusively yourself, do not apply this method on * {@link ExecutorService} instances provided to you by your application * server (e.g. an JEE server). * ------------------------------------------------------------------------- * * @param aExecutorService The service which's threads are to be shut down * soon. */ public static void shutdownGracefully( ExecutorService aExecutorService ) { shutdownGracefully( aExecutorService, DaemonLoopSleepTime.NORM.getMilliseconds() ); }
/** * If on a *nix alike system, this method returns the output of the "uname * -a" command: "uname" prints system information, "-a" instructs it to * print all information. * * @return The "uname -a" output or null if "uname" is not known. */ public static String getUname() { if ( _hasUname ) return _uname; try { _uname = exec( DaemonLoopSleepTime.NORM.getMilliseconds(), "uname -a" ); } catch ( IOException | InterruptedException ignore ) { // try { // _uname = exec( DaemonLoopSleepTime.NORM.getMilliseconds(), "bash", "-c", "uname -a" ); // } // catch ( IOException | InterruptedException ignore2 ) {} } _hasUname = true; return _uname; }
private static int getTputExeWidth() { if ( _canTputExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "tput.exe cols" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canTputExe = false; } } if ( _canBashTputExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash.exe", "-c", "tput cols" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canBashTputExe = false; } } return -1; }
private static int getTputHeight() { if ( _canTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "tput lines" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canTput = false; } } if ( _canBashTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash", "-c", "tput lines" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canBashTput = false; } } return -1; }
private static int getTputWidth() { if ( _canTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "tput cols" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canTput = false; } } if ( _canBashTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash", "-c", "tput cols" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canBashTput = false; } } return -1; }
private static int getTputExeHeight() { if ( _canTputExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "tput.exe lines" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canTputExe = false; } } if ( _canBashTputExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash.exe", "-c", "tput lines" ); if ( theRersult != null ) { return Integer.parseInt( theRersult.trim() ); } } catch ( Exception ignore ) { _canBashTputExe = false; } } return -1; }
private static int getSttyExeHeight() { if ( _canSttyExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "stty.exe size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " ); String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash.exe", "-c", "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " );
private static int getSttyExeWidth() { if ( _canSttyExe ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "stty.exe size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " ); String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash.exe", "-c", "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " );
private static int getSttyHeight() { if ( _canStty ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " ); String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash", "-c", "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " );
private static int getSttyWidth() { if ( _canStty ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " ); String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash", "-c", "stty size" ); if ( theRersult != null ) { String[] theSize = theRersult.trim().split( " " );
private static int getModeConWidth() { if ( _canModeCon ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "mode.com con" ); return toModeConWidth( theRersult ); } catch ( Exception ignore ) { _canModeCon = false; } } if ( _canCmdModeCon ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "cmd.exe", "/c", "mode con" ); return toModeConWidth( theRersult ); } catch ( Exception ignore ) { _canCmdModeCon = false; } } return -1; }
private static int getModeConHeight() { if ( _canModeCon ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "mode.com con" ); return toModeConHeight( theRersult ); } catch ( Exception ignore ) { _canModeCon = false; } } if ( _canCmdModeCon ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "cmd.exe", "/c", "mode con" ); return toModeConHeight( theRersult ); } catch ( Exception ignore ) { _canCmdModeCon = false; } } return -1; }
if ( _canTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "tput colors" ); if ( theRersult != null ) { int theColors = Integer.parseInt( theRersult.trim() ); if ( _canBashTput ) { try { String theRersult = SystemUtility.exec( DaemonLoopSleepTime.MIN.getMilliseconds(), "bash", "-c", "tput colors" ); if ( theRersult != null ) { int theColors = Integer.parseInt( theRersult.trim() );
while ( _restCaller.getConnectionStatus() == ConnectionStatus.NONE ) { try { _restCaller.wait( DaemonLoopSleepTime.MAX.getMilliseconds() ); LOGGER.warn( "Your caller's <" + _restCaller + "> connection status is still <" + _restCaller.getConnectionStatus() + "> after <" + DaemonLoopSleepTime.MAX.getMilliseconds() + "> ms, execution of your request starts not earlyer than you calling the #open() method." );
_executorService.execute( _ioStreamReceiverDaemon ); if ( !_isDaemonAlive ) { RetryTimeout theRetryTimeout = new RetryTimeoutImpl( DaemonLoopSleepTime.NORM.getMilliseconds(), RetryLoopCount.NORM_NUM_RETRY_LOOPS.getNumber() ); while ( !_isDaemonAlive ) { theRetryTimeout.nextRetry();
_executorService.execute( _ioStreamReceiverDaemon ); if ( !_isDaemonAlive ) { RetryTimeout theRetryTimeout = new RetryTimeoutImpl( DaemonLoopSleepTime.NORM.getMilliseconds(), RetryLoopCount.NORM_NUM_RETRY_LOOPS.getNumber() ); while ( !_isDaemonAlive ) { theRetryTimeout.nextRetry();