/* */ package com.arjuna.ats.internal.arjuna.utils;
/* */
/* */ import com.arjuna.ats.arjuna.common.arjPropertyManager;
/* */ import com.arjuna.ats.arjuna.exceptions.FatalError;
/* */ import com.arjuna.ats.arjuna.logging.tsLogger;
/* */ import com.arjuna.ats.arjuna.utils.Process;
/* */ import com.arjuna.common.util.logging.Logi18n;
/* */ import com.arjuna.common.util.propertyservice.PropertyManager;
/* */ import java.net.ServerSocket;
/* */ import java.util.ResourceBundle;
/* */
/* */ public class SocketProcessId
/* */ implements Process
/* */ {
/* 135 */ private static int _thePort = 0;
/* 136 */ private static ServerSocket _theSocket = null;
/* 137 */ private static Object _lock = new Object();
/* */ private static final int _defaultPort = 0;
/* */
/* */ public int getpid()
/* */ {
/* 77 */ synchronized (_lock)
/* */ {
/* 79 */ if (_thePort == 0)
/* */ {
/* 81 */ if (_theSocket == null)
/* */ {
/* 83 */ int port = 0;
/* */
/* 85 */ String portStr = arjPropertyManager.propertyManager.getProperty("com.arjuna.ats.arjuna.recovery.transactionStatusManagerPort");
/* */
/* 87 */ if (portStr != null)
/* */ {
/* */ try
/* */ {
/* 91 */ port = Integer.parseInt(portStr);
/* */ }
/* */ catch (Exception ex)
/* */ {
/* 95 */ if (tsLogger.arjLoggerI18N.isWarnEnabled()) {
/* 96 */ tsLogger.arjLoggerI18N.warn("com.arjuna.ats.internal.arjuna.utils.SocketProcessId_1", ex);
/* */ }
/* 98 */ port = -1;
/* */ }
/* */ }
/* */
/* 102 */ if (port != -1)
/* */ {
/* */ try
/* */ {
/* 106 */ _theSocket = new ServerSocket(port);
/* */
/* 108 */ _thePort = _theSocket.getLocalPort();
/* */ }
/* */ catch (Exception ex)
/* */ {
/* 112 */ _thePort = -1;
/* */ }
/* */ }
/* */ else {
/* 116 */ _thePort = -1;
/* */ }
/* */ }
/* */ }
/* */ }
/* 121 */ if (_thePort == -1) {
/* 122 */ throw new FatalError(tsLogger.log_mesg.getString("com.arjuna.ats.internal.arjuna.utils.SocketProcessId_2"));
/* */ }
/* 124 */ return _thePort;
/* */ }
/* */
/* */ public static final ServerSocket getSocket()
/* */ {
/* 129 */ synchronized (_lock)
/* */ {
/* 131 */ return _theSocket;
/* */ }
/* */ }
/* */ }
/* Location: /home/mnovotny/projects/EMBEDDED_JBOSS_BETA3_COMMUNITY/embedded/output/lib/embedded-jboss/lib/jboss-embedded-all.jar
* Qualified Name: com.arjuna.ats.internal.arjuna.utils.SocketProcessId
* JD-Core Version: 0.6.0
*/