ready javadoc

This commit is contained in:
Naoyuki Kanezawa
2013-05-02 00:59:55 +09:00
parent 5b589bc563
commit bdd2de8555
5 changed files with 24 additions and 17 deletions

View File

@@ -35,6 +35,15 @@
<target>1.6</target> <target>1.6</target>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
<configuration>
<show>protected</show>
<windowtitle>Engine.IO Client API</windowtitle>
</configuration>
</plugin>
<plugin> <plugin>
<groupId>org.codehaus.mojo</groupId> <groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId> <artifactId>exec-maven-plugin</artifactId>

View File

@@ -57,7 +57,7 @@ public abstract class Transport extends Emitter {
return this; return this;
} }
public Emitter open() { public Transport open() {
if (this.readyState == CLOSED || this.readyState < 0) { if (this.readyState == CLOSED || this.readyState < 0) {
this.readyState = OPENING; this.readyState = OPENING;
this.doOpen(); this.doOpen();
@@ -117,6 +117,5 @@ public abstract class Transport extends Emitter {
public int port; public int port;
public int policyPort; public int policyPort;
public Map<String, String> query; public Map<String, String> query;
} }
} }

View File

@@ -78,11 +78,11 @@ public class PollingXHR extends Polling {
this.pollXhr = req; this.pollXhr = req;
} }
private static class Request extends Emitter { public static class Request extends Emitter {
private static final String EVENT_SUCCESS = "success"; public static final String EVENT_SUCCESS = "success";
private static final String EVENT_DATA = "data"; public static final String EVENT_DATA = "data";
private static final String EVENT_ERROR = "error"; public static final String EVENT_ERROR = "error";
private static final ExecutorService xhrService = Executors.newCachedThreadPool(); private static final ExecutorService xhrService = Executors.newCachedThreadPool();
@@ -149,22 +149,22 @@ public class PollingXHR extends Polling {
}); });
} }
public void onSuccess() { private void onSuccess() {
this.emit(EVENT_SUCCESS); this.emit(EVENT_SUCCESS);
this.cleanup(); this.cleanup();
} }
public void onData(String data) { private void onData(String data) {
this.emit(EVENT_DATA, data); this.emit(EVENT_DATA, data);
this.onSuccess(); this.onSuccess();
} }
public void onError(Exception err) { private void onError(Exception err) {
this.emit(EVENT_ERROR, err); this.emit(EVENT_ERROR, err);
this.cleanup(); this.cleanup();
} }
public void cleanup() { private void cleanup() {
if (xhr != null) { if (xhr != null) {
xhr.disconnect(); xhr.disconnect();
xhr = null; xhr = null;
@@ -177,10 +177,9 @@ public class PollingXHR extends Polling {
public static class Options { public static class Options {
String uri; public String uri;
String method; public String method;
String data; public String data;
} }
} }
} }

View File

@@ -96,7 +96,7 @@ public class WebSocket extends Transport {
} }
@Override @Override
public void onClose() { protected void onClose() {
if (this.bufferedAmountId != null) { if (this.bufferedAmountId != null) {
this.bufferedAmountId.cancel(true); this.bufferedAmountId.cancel(true);
} }

View File

@@ -7,7 +7,7 @@ import java.util.Map;
public class Parser { public class Parser {
public static final int protocol = 2; public static final int protocol = 2;
public static final Map<String, Integer> packets = new HashMap<String, Integer>() {{ private static final Map<String, Integer> packets = new HashMap<String, Integer>() {{
put(Packet.OPEN, 0); put(Packet.OPEN, 0);
put(Packet.CLOSE, 1); put(Packet.CLOSE, 1);
put(Packet.PING, 2); put(Packet.PING, 2);
@@ -16,7 +16,7 @@ public class Parser {
put(Packet.UPGRADE, 5); put(Packet.UPGRADE, 5);
put(Packet.NOOP, 6); put(Packet.NOOP, 6);
}}; }};
public static final Map<Integer, String> bipackets = new HashMap<Integer, String>(); private static final Map<Integer, String> bipackets = new HashMap<Integer, String>();
static { static {
for (Map.Entry<String, Integer> entry : packets.entrySet()) { for (Map.Entry<String, Integer> entry : packets.entrySet()) {
bipackets.put(entry.getValue(), entry.getKey()); bipackets.put(entry.getValue(), entry.getKey());