Commit 8b16f6bd authored by Christian Schudt's avatar Christian Schudt

Generify ClusterTask

in the same fashion as e.g. `java.util.concurrent.Callable`
parent 5df5dab9
...@@ -37,7 +37,7 @@ import java.util.Map; ...@@ -37,7 +37,7 @@ import java.util.Map;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetBasicStatistics implements ClusterTask { public class GetBasicStatistics implements ClusterTask<Map<String, Object>> {
public static final String NODE = "node"; public static final String NODE = "node";
public static final String CLIENT = "client"; public static final String CLIENT = "client";
public static final String INCOMING = "incoming"; public static final String INCOMING = "incoming";
...@@ -48,7 +48,7 @@ public class GetBasicStatistics implements ClusterTask { ...@@ -48,7 +48,7 @@ public class GetBasicStatistics implements ClusterTask {
private Map<String, Object> values; private Map<String, Object> values;
@Override @Override
public Object getResult() { public Map<String, Object> getResult() {
return values; return values;
} }
......
...@@ -36,7 +36,7 @@ import java.io.ObjectOutput; ...@@ -36,7 +36,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class NotifyComponentInfo implements ClusterTask { public class NotifyComponentInfo implements ClusterTask<Void> {
private IQ iq; private IQ iq;
public NotifyComponentInfo() { public NotifyComponentInfo() {
...@@ -47,7 +47,7 @@ public class NotifyComponentInfo implements ClusterTask { ...@@ -47,7 +47,7 @@ public class NotifyComponentInfo implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -34,7 +34,7 @@ import java.io.ObjectOutput; ...@@ -34,7 +34,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class NotifyComponentRegistered implements ClusterTask { public class NotifyComponentRegistered implements ClusterTask<Void> {
private JID componentJID; private JID componentJID;
public NotifyComponentRegistered() { public NotifyComponentRegistered() {
...@@ -45,7 +45,7 @@ public class NotifyComponentRegistered implements ClusterTask { ...@@ -45,7 +45,7 @@ public class NotifyComponentRegistered implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -34,7 +34,7 @@ import java.io.ObjectOutput; ...@@ -34,7 +34,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class NotifyComponentUnregistered implements ClusterTask { public class NotifyComponentUnregistered implements ClusterTask<Void> {
private JID componentJID; private JID componentJID;
public NotifyComponentUnregistered() { public NotifyComponentUnregistered() {
...@@ -45,7 +45,7 @@ public class NotifyComponentUnregistered implements ClusterTask { ...@@ -45,7 +45,7 @@ public class NotifyComponentUnregistered implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -41,7 +41,7 @@ import java.util.Enumeration; ...@@ -41,7 +41,7 @@ import java.util.Enumeration;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetAdminConsoleInfoTask implements ClusterTask { public class GetAdminConsoleInfoTask implements ClusterTask<GetAdminConsoleInfoTask> {
private String bindInterface; private String bindInterface;
private int adminPort; private int adminPort;
private int adminSecurePort; private int adminSecurePort;
...@@ -49,7 +49,7 @@ public class GetAdminConsoleInfoTask implements ClusterTask { ...@@ -49,7 +49,7 @@ public class GetAdminConsoleInfoTask implements ClusterTask {
@Override @Override
public Object getResult() { public GetAdminConsoleInfoTask getResult() {
return this; return this;
} }
......
...@@ -33,7 +33,7 @@ import java.io.ObjectOutput; ...@@ -33,7 +33,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class IsPluginInstalledTask implements ClusterTask { public class IsPluginInstalledTask implements ClusterTask<Boolean> {
private String pluginName; private String pluginName;
private boolean installed; private boolean installed;
...@@ -48,7 +48,7 @@ public class IsPluginInstalledTask implements ClusterTask { ...@@ -48,7 +48,7 @@ public class IsPluginInstalledTask implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Boolean getResult() {
return installed; return installed;
} }
......
...@@ -34,7 +34,7 @@ import org.xmpp.packet.JID; ...@@ -34,7 +34,7 @@ import org.xmpp.packet.JID;
* *
* @author Tom Evans * @author Tom Evans
*/ */
public class AddAffiliation extends MUCRoomTask { public class AddAffiliation extends MUCRoomTask<Void> {
private JID bareJID; private JID bareJID;
private MUCRole.Affiliation affiliation; private MUCRole.Affiliation affiliation;
...@@ -63,7 +63,7 @@ public class AddAffiliation extends MUCRoomTask { ...@@ -63,7 +63,7 @@ public class AddAffiliation extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -33,7 +33,7 @@ import org.xmpp.packet.JID; ...@@ -33,7 +33,7 @@ import org.xmpp.packet.JID;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class AddMember extends MUCRoomTask { public class AddMember extends MUCRoomTask<Void> {
private JID bareJID; private JID bareJID;
private String nickname; private String nickname;
...@@ -62,7 +62,7 @@ public class AddMember extends MUCRoomTask { ...@@ -62,7 +62,7 @@ public class AddMember extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -37,7 +37,7 @@ import java.io.ObjectOutput; ...@@ -37,7 +37,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class BroadcastMessageRequest extends MUCRoomTask { public class BroadcastMessageRequest extends MUCRoomTask<Void> {
private int occupants; private int occupants;
private Message message; private Message message;
...@@ -59,7 +59,7 @@ public class BroadcastMessageRequest extends MUCRoomTask { ...@@ -59,7 +59,7 @@ public class BroadcastMessageRequest extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,7 +38,7 @@ import java.io.ObjectOutput; ...@@ -38,7 +38,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class BroadcastPresenceRequest extends MUCRoomTask { public class BroadcastPresenceRequest extends MUCRoomTask<Void> {
private Presence presence; private Presence presence;
private boolean isJoinPresence; private boolean isJoinPresence;
...@@ -61,7 +61,7 @@ public class BroadcastPresenceRequest extends MUCRoomTask { ...@@ -61,7 +61,7 @@ public class BroadcastPresenceRequest extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,7 +38,7 @@ import java.io.ObjectOutput; ...@@ -38,7 +38,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class ChangeNickname extends MUCRoomTask { public class ChangeNickname extends MUCRoomTask<Void> {
private String oldNick; private String oldNick;
private String newNick; private String newNick;
private Presence presence; private Presence presence;
...@@ -66,7 +66,7 @@ public class ChangeNickname extends MUCRoomTask { ...@@ -66,7 +66,7 @@ public class ChangeNickname extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -35,7 +35,7 @@ import org.xmpp.packet.JID; ...@@ -35,7 +35,7 @@ import org.xmpp.packet.JID;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class DestroyRoomRequest extends MUCRoomTask { public class DestroyRoomRequest extends MUCRoomTask<Void> {
private JID alternateJID; // Is allowed to be null! private JID alternateJID; // Is allowed to be null!
private String reason; // Is allowed to be null or empty! private String reason; // Is allowed to be null or empty!
...@@ -55,7 +55,7 @@ public class DestroyRoomRequest extends MUCRoomTask { ...@@ -55,7 +55,7 @@ public class DestroyRoomRequest extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -40,14 +40,14 @@ import java.util.List; ...@@ -40,14 +40,14 @@ import java.util.List;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetNewMemberRoomsRequest implements ClusterTask { public class GetNewMemberRoomsRequest implements ClusterTask<List<RoomInfo>> {
private List<RoomInfo> rooms; private List<RoomInfo> rooms;
public GetNewMemberRoomsRequest() { public GetNewMemberRoomsRequest() {
} }
@Override @Override
public Object getResult() { public List<RoomInfo> getResult() {
return rooms; return rooms;
} }
......
...@@ -34,11 +34,11 @@ import java.io.ObjectOutput; ...@@ -34,11 +34,11 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetNumberConnectedUsers implements ClusterTask{ public class GetNumberConnectedUsers implements ClusterTask<Integer> {
private Integer count; private Integer count;
@Override @Override
public Object getResult() { public Integer getResult() {
return count; return count;
} }
......
...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; ...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public abstract class MUCRoomTask implements ClusterTask { public abstract class MUCRoomTask<V> implements ClusterTask<V> {
private static final Logger Log = LoggerFactory.getLogger(MUCRoomTask.class); private static final Logger Log = LoggerFactory.getLogger(MUCRoomTask.class);
......
...@@ -34,7 +34,7 @@ import java.io.ObjectOutput; ...@@ -34,7 +34,7 @@ import java.io.ObjectOutput;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public class MUCServicePropertyClusterEventTask implements ClusterTask { public class MUCServicePropertyClusterEventTask implements ClusterTask<Void> {
private Type event; private Type event;
private String service; private String service;
private String key; private String key;
...@@ -58,7 +58,7 @@ public class MUCServicePropertyClusterEventTask implements ClusterTask { ...@@ -58,7 +58,7 @@ public class MUCServicePropertyClusterEventTask implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -39,7 +39,7 @@ import java.io.ObjectOutput; ...@@ -39,7 +39,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class OccupantAddedEvent extends MUCRoomTask { public class OccupantAddedEvent extends MUCRoomTask<Void> {
private Presence presence; private Presence presence;
private int role; private int role;
private int affiliation; private int affiliation;
...@@ -119,7 +119,7 @@ public class OccupantAddedEvent extends MUCRoomTask { ...@@ -119,7 +119,7 @@ public class OccupantAddedEvent extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -35,7 +35,7 @@ import java.io.ObjectOutput; ...@@ -35,7 +35,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class OccupantLeftEvent extends MUCRoomTask { public class OccupantLeftEvent extends MUCRoomTask<Void> {
private MUCRole role; private MUCRole role;
private String nickname; private String nickname;
...@@ -60,7 +60,7 @@ public class OccupantLeftEvent extends MUCRoomTask { ...@@ -60,7 +60,7 @@ public class OccupantLeftEvent extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -35,7 +35,7 @@ import java.io.ObjectOutput; ...@@ -35,7 +35,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RoomAvailableEvent implements ClusterTask { public class RoomAvailableEvent implements ClusterTask<Void> {
private LocalMUCRoom room; private LocalMUCRoom room;
public RoomAvailableEvent() { public RoomAvailableEvent() {
...@@ -46,7 +46,7 @@ public class RoomAvailableEvent implements ClusterTask { ...@@ -46,7 +46,7 @@ public class RoomAvailableEvent implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -35,7 +35,7 @@ import java.io.ObjectOutput; ...@@ -35,7 +35,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RoomRemovedEvent implements ClusterTask { public class RoomRemovedEvent implements ClusterTask<Void> {
private LocalMUCRoom room; private LocalMUCRoom room;
public RoomRemovedEvent() { public RoomRemovedEvent() {
...@@ -46,7 +46,7 @@ public class RoomRemovedEvent implements ClusterTask { ...@@ -46,7 +46,7 @@ public class RoomRemovedEvent implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -33,7 +33,7 @@ import java.io.ObjectOutput; ...@@ -33,7 +33,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RoomUpdatedEvent extends MUCRoomTask { public class RoomUpdatedEvent extends MUCRoomTask<Void> {
private LocalMUCRoom room; private LocalMUCRoom room;
public RoomUpdatedEvent() { public RoomUpdatedEvent() {
...@@ -45,7 +45,7 @@ public class RoomUpdatedEvent extends MUCRoomTask { ...@@ -45,7 +45,7 @@ public class RoomUpdatedEvent extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -42,14 +42,14 @@ import java.util.List; ...@@ -42,14 +42,14 @@ import java.util.List;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public class SeniorMemberServicesRequest implements ClusterTask { public class SeniorMemberServicesRequest implements ClusterTask<List<ServiceInfo>> {
private List<ServiceInfo> services; private List<ServiceInfo> services;
public SeniorMemberServicesRequest() { public SeniorMemberServicesRequest() {
} }
@Override @Override
public Object getResult() { public List<ServiceInfo> getResult() {
return services; return services;
} }
......
...@@ -40,7 +40,7 @@ import java.io.ObjectOutput; ...@@ -40,7 +40,7 @@ import java.io.ObjectOutput;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public class ServiceAddedEvent implements ClusterTask { public class ServiceAddedEvent implements ClusterTask<Void> {
private String subdomain; private String subdomain;
private String description; private String description;
private Boolean isHidden; private Boolean isHidden;
...@@ -55,7 +55,7 @@ public class ServiceAddedEvent implements ClusterTask { ...@@ -55,7 +55,7 @@ public class ServiceAddedEvent implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -34,7 +34,7 @@ import java.io.ObjectOutput; ...@@ -34,7 +34,7 @@ import java.io.ObjectOutput;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public class ServiceRemovedEvent implements ClusterTask { public class ServiceRemovedEvent implements ClusterTask<Void> {
private String subdomain; private String subdomain;
public ServiceRemovedEvent() { public ServiceRemovedEvent() {
...@@ -45,7 +45,7 @@ public class ServiceRemovedEvent implements ClusterTask { ...@@ -45,7 +45,7 @@ public class ServiceRemovedEvent implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; ...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
* *
* @author Daniel Henninger * @author Daniel Henninger
*/ */
public class ServiceUpdatedEvent implements ClusterTask { public class ServiceUpdatedEvent implements ClusterTask<Void> {
private static final Logger Log = LoggerFactory.getLogger(ServiceUpdatedEvent.class); private static final Logger Log = LoggerFactory.getLogger(ServiceUpdatedEvent.class);
...@@ -54,7 +54,7 @@ public class ServiceUpdatedEvent implements ClusterTask { ...@@ -54,7 +54,7 @@ public class ServiceUpdatedEvent implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -37,7 +37,7 @@ import java.io.ObjectOutput; ...@@ -37,7 +37,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class UpdateHistoryStrategy implements ClusterTask { public class UpdateHistoryStrategy implements ClusterTask<Void> {
private String serviceName; private String serviceName;
private int type; private int type;
private int maxNumber; private int maxNumber;
...@@ -52,7 +52,7 @@ public class UpdateHistoryStrategy implements ClusterTask { ...@@ -52,7 +52,7 @@ public class UpdateHistoryStrategy implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,7 +38,7 @@ import java.io.ObjectOutput; ...@@ -38,7 +38,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class UpdateOccupant extends MUCRoomTask { public class UpdateOccupant extends MUCRoomTask<Void> {
private Presence presence; private Presence presence;
private String nickname; private String nickname;
private int role; private int role;
...@@ -73,7 +73,7 @@ public class UpdateOccupant extends MUCRoomTask { ...@@ -73,7 +73,7 @@ public class UpdateOccupant extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -39,7 +39,7 @@ import java.io.ObjectOutput; ...@@ -39,7 +39,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class UpdateOccupantRequest extends MUCRoomTask { public class UpdateOccupantRequest extends MUCRoomTask<Element> {
private Element answer; private Element answer;
private String nickname; private String nickname;
private int role; private int role;
...@@ -74,7 +74,7 @@ public class UpdateOccupantRequest extends MUCRoomTask { ...@@ -74,7 +74,7 @@ public class UpdateOccupantRequest extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Element getResult() {
return answer; return answer;
} }
......
...@@ -37,7 +37,7 @@ import java.io.ObjectOutput; ...@@ -37,7 +37,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class UpdatePresence extends MUCRoomTask { public class UpdatePresence extends MUCRoomTask<Void> {
private Presence presence; private Presence presence;
private String nickname; private String nickname;
...@@ -59,7 +59,7 @@ public class UpdatePresence extends MUCRoomTask { ...@@ -59,7 +59,7 @@ public class UpdatePresence extends MUCRoomTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -8,7 +8,7 @@ import org.jivesoftware.openfire.pubsub.PubSubPersistenceManager; ...@@ -8,7 +8,7 @@ import org.jivesoftware.openfire.pubsub.PubSubPersistenceManager;
import org.jivesoftware.util.cache.ClusterTask; import org.jivesoftware.util.cache.ClusterTask;
public class FlushTask implements ClusterTask public class FlushTask implements ClusterTask<Void>
{ {
public FlushTask() public FlushTask()
{ {
...@@ -21,7 +21,7 @@ public class FlushTask implements ClusterTask ...@@ -21,7 +21,7 @@ public class FlushTask implements ClusterTask
} }
@Override @Override
public Object getResult() public Void getResult()
{ {
return null; return null;
} }
......
...@@ -16,7 +16,7 @@ import org.jivesoftware.util.cache.ExternalizableUtil; ...@@ -16,7 +16,7 @@ import org.jivesoftware.util.cache.ExternalizableUtil;
* @author Robin Collier * @author Robin Collier
* *
*/ */
public abstract class NodeChangeTask implements ClusterTask public abstract class NodeChangeTask implements ClusterTask<Void>
{ {
private String nodeId; private String nodeId;
transient private Node node; transient private Node node;
......
...@@ -12,7 +12,7 @@ import org.jivesoftware.util.cache.ClusterTask; ...@@ -12,7 +12,7 @@ import org.jivesoftware.util.cache.ClusterTask;
import org.jivesoftware.util.cache.ExternalizableUtil; import org.jivesoftware.util.cache.ExternalizableUtil;
import org.xmpp.packet.JID; import org.xmpp.packet.JID;
public abstract class NodeTask implements ClusterTask public abstract class NodeTask implements ClusterTask<Void>
{ {
protected String nodeId; protected String nodeId;
...@@ -53,7 +53,7 @@ public abstract class NodeTask implements ClusterTask ...@@ -53,7 +53,7 @@ public abstract class NodeTask implements ClusterTask
} }
@Override @Override
public Object getResult() public Void getResult()
{ {
return null; return null;
} }
......
...@@ -33,7 +33,7 @@ import java.io.ObjectOutput; ...@@ -33,7 +33,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetSessionsCountTask implements ClusterTask { public class GetSessionsCountTask implements ClusterTask<Integer> {
private Boolean authenticated; private Boolean authenticated;
private Integer count; private Integer count;
...@@ -45,7 +45,7 @@ public class GetSessionsCountTask implements ClusterTask { ...@@ -45,7 +45,7 @@ public class GetSessionsCountTask implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Integer getResult() {
return count; return count;
} }
......
...@@ -33,7 +33,7 @@ import java.io.ObjectOutput; ...@@ -33,7 +33,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class PropertyClusterEventTask implements ClusterTask { public class PropertyClusterEventTask implements ClusterTask<Void> {
private Type event; private Type event;
private String key; private String key;
private String value; private String value;
...@@ -54,7 +54,7 @@ public class PropertyClusterEventTask implements ClusterTask { ...@@ -54,7 +54,7 @@ public class PropertyClusterEventTask implements ClusterTask {
} }
@Override @Override
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -556,7 +556,7 @@ public class CacheFactory { ...@@ -556,7 +556,7 @@ public class CacheFactory {
* *
* @param task the task to be invoked on all other cluster members. * @param task the task to be invoked on all other cluster members.
*/ */
public static void doClusterTask(final ClusterTask task) { public static void doClusterTask(final ClusterTask<?> task) {
cacheFactoryStrategy.doClusterTask(task); cacheFactoryStrategy.doClusterTask(task);
} }
...@@ -568,7 +568,7 @@ public class CacheFactory { ...@@ -568,7 +568,7 @@ public class CacheFactory {
* @param nodeID the byte array that identifies the target cluster member. * @param nodeID the byte array that identifies the target cluster member.
* @throws IllegalStateException if requested node was not found or not running in a cluster. * @throws IllegalStateException if requested node was not found or not running in a cluster.
*/ */
public static void doClusterTask(final ClusterTask task, byte[] nodeID) { public static void doClusterTask(final ClusterTask<?> task, byte[] nodeID) {
cacheFactoryStrategy.doClusterTask(task, nodeID); cacheFactoryStrategy.doClusterTask(task, nodeID);
} }
...@@ -582,7 +582,7 @@ public class CacheFactory { ...@@ -582,7 +582,7 @@ public class CacheFactory {
* @param includeLocalMember true to run the task on the local member, false otherwise * @param includeLocalMember true to run the task on the local member, false otherwise
* @return collection with the result of the execution. * @return collection with the result of the execution.
*/ */
public static Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember) { public static Collection<Object> doSynchronousClusterTask(ClusterTask<?> task, boolean includeLocalMember) {
return cacheFactoryStrategy.doSynchronousClusterTask(task, includeLocalMember); return cacheFactoryStrategy.doSynchronousClusterTask(task, includeLocalMember);
} }
...@@ -595,7 +595,7 @@ public class CacheFactory { ...@@ -595,7 +595,7 @@ public class CacheFactory {
* @return result of remote operation or null if operation failed or operation returned null. * @return result of remote operation or null if operation failed or operation returned null.
* @throws IllegalStateException if requested node was not found or not running in a cluster. * @throws IllegalStateException if requested node was not found or not running in a cluster.
*/ */
public static Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID) { public static Object doSynchronousClusterTask(ClusterTask<?> task, byte[] nodeID) {
return cacheFactoryStrategy.doSynchronousClusterTask(task, nodeID); return cacheFactoryStrategy.doSynchronousClusterTask(task, nodeID);
} }
......
...@@ -114,7 +114,7 @@ public interface CacheFactoryStrategy { ...@@ -114,7 +114,7 @@ public interface CacheFactoryStrategy {
* *
* @return Synchronized time for all cluster members * @return Synchronized time for all cluster members
*/ */
public long getClusterTime(); long getClusterTime();
/** /**
* Invokes a task on other cluster members in an asynchronous fashion. The task will not be * Invokes a task on other cluster members in an asynchronous fashion. The task will not be
...@@ -123,7 +123,7 @@ public interface CacheFactoryStrategy { ...@@ -123,7 +123,7 @@ public interface CacheFactoryStrategy {
* *
* @param task the task to be invoked on all other cluster members. * @param task the task to be invoked on all other cluster members.
*/ */
void doClusterTask(final ClusterTask task); void doClusterTask(final ClusterTask<?> task);
/** /**
...@@ -134,7 +134,7 @@ public interface CacheFactoryStrategy { ...@@ -134,7 +134,7 @@ public interface CacheFactoryStrategy {
* @param nodeID the byte array that identifies the target cluster member. * @param nodeID the byte array that identifies the target cluster member.
* @throws IllegalStateException if requested node was not found. * @throws IllegalStateException if requested node was not found.
*/ */
void doClusterTask(ClusterTask task, byte[] nodeID); void doClusterTask(ClusterTask<?> task, byte[] nodeID);
/** /**
* Invokes a task on other cluster members synchronously and returns the result as a Collection * Invokes a task on other cluster members synchronously and returns the result as a Collection
...@@ -146,7 +146,7 @@ public interface CacheFactoryStrategy { ...@@ -146,7 +146,7 @@ public interface CacheFactoryStrategy {
* @param includeLocalMember true to run the task on the local member, false otherwise * @param includeLocalMember true to run the task on the local member, false otherwise
* @return collection with the result of the execution. * @return collection with the result of the execution.
*/ */
Collection<Object> doSynchronousClusterTask(ClusterTask task, boolean includeLocalMember); Collection<Object> doSynchronousClusterTask(ClusterTask<?> task, boolean includeLocalMember);
/** /**
* Invokes a task on a given cluster member synchronously and returns the result of * Invokes a task on a given cluster member synchronously and returns the result of
...@@ -157,7 +157,7 @@ public interface CacheFactoryStrategy { ...@@ -157,7 +157,7 @@ public interface CacheFactoryStrategy {
* @return result of remote operation or null if operation failed or operation returned null. * @return result of remote operation or null if operation failed or operation returned null.
* @throws IllegalStateException if requested node was not found. * @throws IllegalStateException if requested node was not found.
*/ */
Object doSynchronousClusterTask(ClusterTask task, byte[] nodeID); Object doSynchronousClusterTask(ClusterTask<?> task, byte[] nodeID);
/** /**
* Updates the statistics of the specified caches and publishes them into * Updates the statistics of the specified caches and publishes them into
......
...@@ -22,12 +22,12 @@ package org.jivesoftware.util.cache; ...@@ -22,12 +22,12 @@ package org.jivesoftware.util.cache;
import java.io.Externalizable; import java.io.Externalizable;
/** /**
* An interface to mix in Serializable and Runnable, which are both required for * An interface to mix in {@link Externalizable} and {@link Runnable}, which are both required for
* sending invocable tasks across a cluster. * sending invokable tasks across a cluster.
*/ */
public interface ClusterTask extends Runnable, Externalizable { public interface ClusterTask<V> extends Runnable, Externalizable {
public Object getResult(); V getResult();
} }
...@@ -36,7 +36,7 @@ import java.io.ObjectOutput; ...@@ -36,7 +36,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class DeliverRawTextTask implements ClusterTask { public class DeliverRawTextTask implements ClusterTask<Void> {
private SessionType sessionType; private SessionType sessionType;
private JID address; private JID address;
private String streamID; private String streamID;
...@@ -72,7 +72,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -72,7 +72,7 @@ public class DeliverRawTextTask implements ClusterTask {
this.text = text; this.text = text;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,7 +38,7 @@ import java.io.ObjectOutput; ...@@ -38,7 +38,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class ProcessPacketTask implements ClusterTask { public class ProcessPacketTask implements ClusterTask<Void> {
private SessionType sessionType; private SessionType sessionType;
private JID address; private JID address;
private String streamID; private String streamID;
...@@ -74,7 +74,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -74,7 +74,7 @@ public class ProcessPacketTask implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; ...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public abstract class RemoteSessionTask implements ClusterTask { public abstract class RemoteSessionTask implements ClusterTask<Object> {
protected Object result; protected Object result;
protected Operation operation; protected Operation operation;
......
...@@ -34,7 +34,7 @@ import java.io.ObjectOutput; ...@@ -34,7 +34,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class BroadcastMessage implements ClusterTask { public class BroadcastMessage implements ClusterTask<Void> {
private Message packet; private Message packet;
...@@ -46,7 +46,7 @@ public class BroadcastMessage implements ClusterTask { ...@@ -46,7 +46,7 @@ public class BroadcastMessage implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
// Not used since we are using #execute and not #query when using InvocationService // Not used since we are using #execute and not #query when using InvocationService
return null; return null;
} }
......
...@@ -36,7 +36,7 @@ import java.io.ObjectOutput; ...@@ -36,7 +36,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RemotePacketExecution implements ClusterTask { public class RemotePacketExecution implements ClusterTask<Void> {
private JID receipient; private JID receipient;
private Packet packet; private Packet packet;
...@@ -49,7 +49,7 @@ public class RemotePacketExecution implements ClusterTask { ...@@ -49,7 +49,7 @@ public class RemotePacketExecution implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
// Not used since we are using #execute and not #query when using InvocationService // Not used since we are using #execute and not #query when using InvocationService
return null; return null;
} }
......
...@@ -36,7 +36,7 @@ import java.io.ObjectOutput; ...@@ -36,7 +36,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class DeliverRawTextTask implements ClusterTask { public class DeliverRawTextTask implements ClusterTask<Void> {
private SessionType sessionType; private SessionType sessionType;
private JID address; private JID address;
private String streamID; private String streamID;
...@@ -72,7 +72,7 @@ public class DeliverRawTextTask implements ClusterTask { ...@@ -72,7 +72,7 @@ public class DeliverRawTextTask implements ClusterTask {
this.text = text; this.text = text;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,7 +38,7 @@ import java.io.ObjectOutput; ...@@ -38,7 +38,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class ProcessPacketTask implements ClusterTask { public class ProcessPacketTask implements ClusterTask<Void> {
private SessionType sessionType; private SessionType sessionType;
private JID address; private JID address;
private String streamID; private String streamID;
...@@ -74,7 +74,7 @@ public class ProcessPacketTask implements ClusterTask { ...@@ -74,7 +74,7 @@ public class ProcessPacketTask implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit; ...@@ -37,7 +37,7 @@ import java.util.concurrent.TimeUnit;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public abstract class RemoteSessionTask implements ClusterTask { public abstract class RemoteSessionTask implements ClusterTask<Object> {
protected Object result; protected Object result;
protected Operation operation; protected Operation operation;
......
...@@ -470,17 +470,17 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy { ...@@ -470,17 +470,17 @@ public class ClusteredCacheFactory implements CacheFactoryStrategy {
} }
} }
private static class CallableTask<Object> implements Callable<Object>, Serializable { private static class CallableTask<V> implements Callable<V>, Serializable {
private ClusterTask task; private ClusterTask<V> task;
public CallableTask(ClusterTask task) { public CallableTask(ClusterTask<V> task) {
this.task = task; this.task = task;
} }
public Object call() { public V call() {
task.run(); task.run();
logger.debug("CallableTask[" + task.getClass().getName() + "] result: " + task.getResult()); logger.debug("CallableTask[" + task.getClass().getName() + "] result: " + task.getResult());
return (Object) task.getResult(); return task.getResult();
} }
} }
......
...@@ -34,7 +34,7 @@ import org.xmpp.packet.Message; ...@@ -34,7 +34,7 @@ import org.xmpp.packet.Message;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class BroadcastMessage implements ClusterTask { public class BroadcastMessage implements ClusterTask<Void> {
private Message packet; private Message packet;
...@@ -46,7 +46,7 @@ public class BroadcastMessage implements ClusterTask { ...@@ -46,7 +46,7 @@ public class BroadcastMessage implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
// Not used since we are using #execute and not #query when using InvocationService // Not used since we are using #execute and not #query when using InvocationService
return null; return null;
} }
......
...@@ -74,8 +74,8 @@ public class NodeRuntimeStats { ...@@ -74,8 +74,8 @@ public class NodeRuntimeStats {
/** /**
* Encapsulates statistics and information about a cluster node. * Encapsulates statistics and information about a cluster node.
*/ */
public static class NodeInfoTask implements ClusterTask { public static class NodeInfoTask implements ClusterTask<NodeInfo> {
private Object result = null; private NodeInfo result = null;
public void run() { public void run() {
// Get runtime stats - mem and time: // Get runtime stats - mem and time:
...@@ -93,10 +93,10 @@ public class NodeRuntimeStats { ...@@ -93,10 +93,10 @@ public class NodeRuntimeStats {
} }
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
result = ExternalizableUtil.getInstance().readSerializable(in); result = (NodeInfo) ExternalizableUtil.getInstance().readSerializable(in);
} }
public Object getResult() { return result; } public NodeInfo getResult() { return result; }
} }
......
...@@ -40,7 +40,7 @@ import org.xmpp.packet.Presence; ...@@ -40,7 +40,7 @@ import org.xmpp.packet.Presence;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class RemotePacketExecution implements ClusterTask { public class RemotePacketExecution implements ClusterTask<Void> {
private JID recipient; private JID recipient;
private Packet packet; private Packet packet;
...@@ -53,7 +53,7 @@ public class RemotePacketExecution implements ClusterTask { ...@@ -53,7 +53,7 @@ public class RemotePacketExecution implements ClusterTask {
this.packet = packet; this.packet = packet;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -35,10 +35,10 @@ import java.io.ObjectOutput; ...@@ -35,10 +35,10 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetConversationCountTask implements ClusterTask { public class GetConversationCountTask implements ClusterTask<Integer> {
private int conversationCount; private int conversationCount;
public Object getResult() { public Integer getResult() {
return conversationCount; return conversationCount;
} }
......
...@@ -37,7 +37,7 @@ import java.io.ObjectOutput; ...@@ -37,7 +37,7 @@ import java.io.ObjectOutput;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetConversationTask implements ClusterTask { public class GetConversationTask implements ClusterTask<Conversation> {
private long conversationID; private long conversationID;
private Conversation conversation; private Conversation conversation;
...@@ -48,7 +48,7 @@ public class GetConversationTask implements ClusterTask { ...@@ -48,7 +48,7 @@ public class GetConversationTask implements ClusterTask {
this.conversationID = conversationID; this.conversationID = conversationID;
} }
public Object getResult() { public Conversation getResult() {
return conversation; return conversation;
} }
......
...@@ -37,10 +37,10 @@ import java.util.Collection; ...@@ -37,10 +37,10 @@ import java.util.Collection;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetConversationsTask implements ClusterTask { public class GetConversationsTask implements ClusterTask<Collection<Conversation>> {
private Collection<Conversation> conversations; private Collection<Conversation> conversations;
public Object getResult() { public Collection<Conversation> getResult() {
return conversations; return conversations;
} }
......
...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory; ...@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class SendConversationEventsTask implements ClusterTask { public class SendConversationEventsTask implements ClusterTask<Void> {
private static final Logger Log = LoggerFactory.getLogger(SendConversationEventsTask.class); private static final Logger Log = LoggerFactory.getLogger(SendConversationEventsTask.class);
...@@ -56,7 +56,7 @@ public class SendConversationEventsTask implements ClusterTask { ...@@ -56,7 +56,7 @@ public class SendConversationEventsTask implements ClusterTask {
this.events = events; this.events = events;
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
...@@ -38,13 +38,13 @@ import org.slf4j.LoggerFactory; ...@@ -38,13 +38,13 @@ import org.slf4j.LoggerFactory;
* *
* @author Gaston Dombiak * @author Gaston Dombiak
*/ */
public class GetStatistics implements ClusterTask { public class GetStatistics implements ClusterTask<Map<String, Double>> {
private static final Logger Log = LoggerFactory.getLogger(GetStatistics.class); private static final Logger Log = LoggerFactory.getLogger(GetStatistics.class);
private Map<String, Double> samples; private Map<String, Double> samples;
public Object getResult() { public Map<String, Double> getResult() {
return samples; return samples;
} }
......
...@@ -9,7 +9,7 @@ import java.io.ObjectInput; ...@@ -9,7 +9,7 @@ import java.io.ObjectInput;
import java.io.ObjectOutput; import java.io.ObjectOutput;
public class RulesUpdatedEvent implements ClusterTask { public class RulesUpdatedEvent implements ClusterTask<Void> {
...@@ -17,7 +17,7 @@ public class RulesUpdatedEvent implements ClusterTask { ...@@ -17,7 +17,7 @@ public class RulesUpdatedEvent implements ClusterTask {
} }
public Object getResult() { public Void getResult() {
return null; return null;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment