[vlma-devel] commit: Decrease the connection timeout when checking a server's state. ( Adrien Grand )
git version control
git at videolan.org
Sun Sep 14 01:59:17 CEST 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Sat Sep 13 17:50:31 2008 +0200| [c3cb7f11171b75bec44ef1d1bb003ed194ce45d8] | committer: Adrien Grand
Decrease the connection timeout when checking a server's state.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=c3cb7f11171b75bec44ef1d1bb003ed194ce45d8
---
.../java/org/videolan/vlma/VLMaServiceImpl.java | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
index 3c77e59..16eaa78 100644
--- a/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
+++ b/vlma-core/src/main/java/org/videolan/vlma/VLMaServiceImpl.java
@@ -23,6 +23,7 @@ package org.videolan.vlma;
import java.awt.Color;
import java.io.File;
import java.io.IOException;
+import java.net.InetSocketAddress;
import java.net.Socket;
import java.util.HashSet;
import java.util.List;
@@ -59,6 +60,7 @@ import org.videolan.vlma.retriever.DataRetriever;
public class VLMaServiceImpl implements VLMaService {
public static final String DATA_FILE = "data.xml";
+ public static final int SOCKET_TIMEOUT = 5000;
private static final Logger logger = Logger.getLogger(VLMaServiceImpl.class);
@@ -283,7 +285,8 @@ public class VLMaServiceImpl implements VLMaService {
synchronized public boolean checkVLC(Server server) {
boolean formerState = server.isUp();
try {
- Socket socket = new Socket(server.getIp(), configuration.getInt("vlc.telnet.port"));
+ Socket socket = new Socket();
+ socket.connect(new InetSocketAddress(server.getIp(), configuration.getInt("vlc.telnet.port")), SOCKET_TIMEOUT);
socket.close();
server.setUp(true);
logger.debug("VLC of " + server.getName() + " is reachable");
More information about the vlma-devel
mailing list