use of games.strategy.net.GUID in project triplea by triplea-game.
the class UnifiedMessenger method invokeAndWaitRemote.
private RemoteMethodCallResults invokeAndWaitRemote(final RemoteMethodCall remoteCall) {
final GUID methodCallId = new GUID();
final CountDownLatch latch = new CountDownLatch(1);
synchronized (pendingLock) {
pendingInvocations.put(methodCallId, latch);
}
// invoke remotely
final Invoke invoke = new HubInvoke(methodCallId, true, remoteCall);
send(invoke, messenger.getServerNode());
Interruptibles.await(latch);
synchronized (pendingLock) {
final RemoteMethodCallResults methodCallResults = results.remove(methodCallId);
if (methodCallResults == null) {
throw new IllegalStateException("No results from remote call. Method returned:" + remoteCall.getMethodName() + " for remote name:" + remoteCall.getRemoteName() + " with id:" + methodCallId);
}
return methodCallResults;
}
}
use of games.strategy.net.GUID in project triplea by triplea-game.
the class UnifiedMessengerHub method results.
private void results(final HubInvocationResults results, final INode from) {
final GUID methodId = results.methodCallId;
final InvocationInProgress invocationInProgress = invocations.get(methodId);
final boolean done = invocationInProgress.process(results, from);
if (done) {
invocations.remove(methodId);
if (invocationInProgress.shouldSendResults()) {
sendResultsToCaller(methodId, invocationInProgress);
}
}
}
use of games.strategy.net.GUID in project triplea by triplea-game.
the class LobbyGameTableModelTest method removeGameThatDoesNotExistIsIgnored.
@Test
public void removeGameThatDoesNotExistIsIgnored() {
testObj.getLobbyGameBroadcaster().gameRemoved(new GUID());
TestUtil.waitForSwingThreads();
assertThat(testObj.getRowCount(), is(1));
}
use of games.strategy.net.GUID in project triplea by triplea-game.
the class LobbyGameTableModelTest method updateGameAddsIfDoesNotExist.
@Test
public void updateGameAddsIfDoesNotExist() {
testObj.getLobbyGameBroadcaster().gameUpdated(new GUID(), new GameDescription());
TestUtil.waitForSwingThreads();
assertThat(testObj.getRowCount(), is(2));
}
use of games.strategy.net.GUID in project triplea by triplea-game.
the class PlayerOwnerChange method perform.
@Override
protected void perform(final GameData data) {
for (final GUID id : m_new.keySet()) {
final Unit unit = data.getUnits().get(id);
if (!m_old.get(id).equals(unit.getOwner().getName())) {
throw new IllegalStateException("Wrong owner, expecting" + m_old.get(id) + " but got " + unit.getOwner());
}
final String owner = m_new.get(id);
final PlayerID player = data.getPlayerList().getPlayerId(owner);
unit.setOwner(player);
}
data.getMap().getTerritory(m_location).notifyChanged();
}
Aggregations