Project

General

Profile

« Previous | Next » 

Revision 7317

only look up the client timeout property once, not every time we make a call
https://redmine.dataone.org/issues/3078

View differences:

src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
115 115
	private static String FIRSTTIME = "replication.firsttimedreplication";
116 116
	private static final int TIMEINTERVALLIMIT = 7200000;
117 117
	public static final String REPLICATIONUSER = "replication";
118
	
119
	private static int CLIENTTIMEOUT = 30000;
118 120

  
119 121
	public static final String REPLICATION_LOG_FILE_NAME = "metacatreplication.log";
120 122
	public static String METACAT_REPL_ERROR_MSG = null;
121 123
	private static Logger logReplication = Logger.getLogger("ReplicationLogging");
122 124
	private static Logger logMetacat = Logger.getLogger(ReplicationService.class);
123 125

  
126
	static {
127
		// lookup the client timeout
128
		String clientTimeout = null;
129
		try {
130
			clientTimeout = PropertyService.getProperty("replication.client.timeout");
131
			CLIENTTIMEOUT = Integer.parseInt(clientTimeout);
132
		} catch (Exception e) {
133
			// just use default
134
			logReplication.warn("No custom client timeout specified in configuration, using default." + e.getMessage());
135
		}
136
	}
137
	
124 138
	private ReplicationService() throws ServiceException {
125 139
		_serviceName = "ReplicationService";
126 140
		
......
2081 2095
			// this is pretty much required for replication communication
2082 2096
			logReplication.warn("Could not find server's client certificate/private key: " + e.getMessage());
2083 2097
		}
2084
		String clientTimeout = null;
2085
		try {
2086
			clientTimeout = PropertyService.getProperty("replication.client.timeout");
2087
			int timeoutMs = Integer.parseInt(clientTimeout);
2088
			client.setTimeouts(timeoutMs);
2089
		} catch (Exception e) {
2090
			// just use default
2091
			logReplication.warn("No custom client timeout specified in configuration, using default." + e.getMessage());
2092
		}
2098
		
2099
		// set the configured timeout
2100
		client.setTimeouts(CLIENTTIMEOUT);
2093 2101

  
2094 2102
		SSLSocketFactory socketFactory = null;
2095 2103
		try {

Also available in: Unified diff