blob: 64ea28866527597870281adeb93ef4dc717305c4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
/*
@VaadinApache2LicenseForJavaFiles@
*/
package com.vaadin.terminal.gwt.server;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.lang.reflect.Type;
/**
* Internal class for keeping track of pending server to client method
* invocations for a Connector.
*
* @since 7.0
*/
public class ClientMethodInvocation implements Serializable,
Comparable<ClientMethodInvocation> {
private final ClientConnector connector;
private final String interfaceName;
private final String methodName;
private final Object[] parameters;
private Type[] parameterTypes;
// used for sorting calls between different connectors in the same Root
private final long sequenceNumber;
// TODO may cause problems when clustering etc.
private static long counter = 0;
public ClientMethodInvocation(ClientConnector connector,
String interfaceName, Method method, Object[] parameters) {
this.connector = connector;
this.interfaceName = interfaceName;
methodName = method.getName();
parameterTypes = method.getGenericParameterTypes();
this.parameters = (null != parameters) ? parameters : new Object[0];
sequenceNumber = ++counter;
}
public Type[] getParameterTypes() {
return parameterTypes;
}
public ClientConnector getConnector() {
return connector;
}
public String getInterfaceName() {
return interfaceName;
}
public String getMethodName() {
return methodName;
}
public Object[] getParameters() {
return parameters;
}
protected long getSequenceNumber() {
return sequenceNumber;
}
@Override
public int compareTo(ClientMethodInvocation o) {
if (null == o) {
return 0;
}
return Long.signum(getSequenceNumber() - o.getSequenceNumber());
}
}
|