Working on the new polling.
This commit is contained in:
@@ -61,18 +61,18 @@ public class ChatRequestHandler extends LotroServerRequestHandler implements Uri
|
|||||||
throw new HttpProcessingException(404);
|
throw new HttpProcessingException(404);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (message != null && message.trim().length() > 0)
|
if (message != null && message.trim().length() > 0) {
|
||||||
chatRoom.sendMessage(resourceOwner.getName(), StringEscapeUtils.escapeHtml(message), resourceOwner.getType().contains("a"));
|
chatRoom.sendMessage(resourceOwner.getName(), StringEscapeUtils.escapeHtml(message), resourceOwner.getType().contains("a"));
|
||||||
} catch (PrivateInformationException exp) {
|
responseWriter.writeXmlResponse(null);
|
||||||
throw new HttpProcessingException(403);
|
} else {
|
||||||
}
|
ChatCommunicationChannel pollableResource = chatRoom.getChatRoomListener(resourceOwner.getName());
|
||||||
|
ChatUpdateLongPollingResource polledResource = new ChatUpdateLongPollingResource(chatRoom, room, resourceOwner.getName(), responseWriter);
|
||||||
try {
|
_longPollingSystem.processLongPollingResource(polledResource, pollableResource);
|
||||||
ChatCommunicationChannel pollableResource = chatRoom.getChatRoomListener(resourceOwner.getName());
|
}
|
||||||
ChatUpdateLongPollingResource polledResource = new ChatUpdateLongPollingResource(chatRoom, room, resourceOwner.getName(), responseWriter);
|
|
||||||
_longPollingSystem.processLongPollingResource(polledResource, pollableResource);
|
|
||||||
} catch (SubscriptionExpiredException exp) {
|
} catch (SubscriptionExpiredException exp) {
|
||||||
responseWriter.writeError(410);
|
responseWriter.writeError(410);
|
||||||
|
} catch (PrivateInformationException exp) {
|
||||||
|
throw new HttpProcessingException(403);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -240,9 +240,7 @@ var ChatBoxUI = Class.extend({
|
|||||||
|
|
||||||
sendMessage:function (message) {
|
sendMessage:function (message) {
|
||||||
var that = this;
|
var that = this;
|
||||||
this.communication.sendChatMessage(this.name, message, function(xml) {
|
this.communication.sendChatMessage(this.name, message, this.chatErrorMap());
|
||||||
that.processMessages(xml, false);
|
|
||||||
}, this.chatErrorMap());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
chatMalfunction: function() {
|
chatMalfunction: function() {
|
||||||
|
|||||||
@@ -473,7 +473,7 @@ var GempLotrCommunication = Class.extend({
|
|||||||
dataType:"xml"
|
dataType:"xml"
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
sendChatMessage:function (room, messages, callback, errorMap) {
|
sendChatMessage:function (room, messages, errorMap) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type:"POST",
|
type:"POST",
|
||||||
url:this.url + "/chat/" + room,
|
url:this.url + "/chat/" + room,
|
||||||
@@ -482,7 +482,6 @@ var GempLotrCommunication = Class.extend({
|
|||||||
data:{
|
data:{
|
||||||
participantId:getUrlParam("participantId"),
|
participantId:getUrlParam("participantId"),
|
||||||
message:messages},
|
message:messages},
|
||||||
success:callback,
|
|
||||||
traditional:true,
|
traditional:true,
|
||||||
error:this.errorCheck(errorMap),
|
error:this.errorCheck(errorMap),
|
||||||
dataType:"xml"
|
dataType:"xml"
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public class LongPollingSystem {
|
|||||||
private static Logger _log = Logger.getLogger(LongPollingSystem.class);
|
private static Logger _log = Logger.getLogger(LongPollingSystem.class);
|
||||||
|
|
||||||
private ConcurrentLinkedQueue<TimeoutResource> _waitingActions = new ConcurrentLinkedQueue<TimeoutResource>();
|
private ConcurrentLinkedQueue<TimeoutResource> _waitingActions = new ConcurrentLinkedQueue<TimeoutResource>();
|
||||||
private long _pollingInterval = 200;
|
private long _pollingInterval = 1000;
|
||||||
private long _pollingLength = 10000;
|
private long _pollingLength = 10000;
|
||||||
private ProcessingRunnable _processingRunnable;
|
private ProcessingRunnable _processingRunnable;
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ public class ChatRoomMediator {
|
|||||||
|
|
||||||
private Map<String, ChatCommunicationChannel> _listeners = new HashMap<String, ChatCommunicationChannel>();
|
private Map<String, ChatCommunicationChannel> _listeners = new HashMap<String, ChatCommunicationChannel>();
|
||||||
|
|
||||||
private int _channelInactivityTimeoutPeriod = 1000 * 20; // 10 seconds
|
private final int _channelInactivityTimeoutPeriod;
|
||||||
private Set<String> _allowedPlayers;
|
private Set<String> _allowedPlayers;
|
||||||
|
|
||||||
private ReadWriteLock _lock = new ReentrantReadWriteLock();
|
private ReadWriteLock _lock = new ReentrantReadWriteLock();
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public class HallServer extends AbstractServer {
|
|||||||
_collectionsManager = collectionsManager;
|
_collectionsManager = collectionsManager;
|
||||||
_tournamentPrizeSchemeRegistry = tournamentPrizeSchemeRegistry;
|
_tournamentPrizeSchemeRegistry = tournamentPrizeSchemeRegistry;
|
||||||
_pairingMechanismRegistry = pairingMechanismRegistry;
|
_pairingMechanismRegistry = pairingMechanismRegistry;
|
||||||
_hallChat = _chatServer.createChatRoom("Game Hall", true, 10);
|
_hallChat = _chatServer.createChatRoom("Game Hall", true, 15);
|
||||||
|
|
||||||
_tournamentQueues.put("fotr_queue", new ImmediateRecurringQueue(635, "fotr_block",
|
_tournamentQueues.put("fotr_queue", new ImmediateRecurringQueue(635, "fotr_block",
|
||||||
CollectionType.ALL_CARDS, "fotrQueue-", "Fellowship Block", 8,
|
CollectionType.ALL_CARDS, "fotrQueue-", "Fellowship Block", 8,
|
||||||
|
|||||||
Reference in New Issue
Block a user