Style fixes and import pruning. Beware, CheckStyle is (finally) coming to town.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5240 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -28,7 +28,7 @@ import com.threerings.bureau.util.BureauContext;
|
||||
import com.threerings.presents.dobj.DObjectManager;
|
||||
import com.samskivert.util.Config;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Represents a client embedded in a bureau.
|
||||
*/
|
||||
public abstract class BureauClient extends Client
|
||||
@@ -53,7 +53,7 @@ public abstract class BureauClient extends Client
|
||||
|
||||
protected BureauContext createContext ()
|
||||
{
|
||||
return new BureauContext () {
|
||||
return new BureauContext() {
|
||||
public BureauDirector getBureauDirector () {
|
||||
return _director;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public abstract class BureauDirector extends BasicDirector
|
||||
|
||||
log.info("Subscribing to object " + agentId);
|
||||
|
||||
SafeSubscriber<AgentObject> subscriber =
|
||||
SafeSubscriber<AgentObject> subscriber =
|
||||
new SafeSubscriber<AgentObject>(agentId, delegator);
|
||||
_subscribers.put(agentId, subscriber);
|
||||
subscriber.subscribe(_ctx.getDObjectManager());
|
||||
@@ -67,19 +67,16 @@ public abstract class BureauDirector extends BasicDirector
|
||||
|
||||
if (agent == null) {
|
||||
log.warning("Lost an agent, id " + agentId);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
try {
|
||||
agent.stop();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
} catch (Throwable t) {
|
||||
log.warning("Stopping an agent caused an exception", t);
|
||||
}
|
||||
SafeSubscriber<AgentObject> subscriber = _subscribers.remove(agentId);
|
||||
if (subscriber == null) {
|
||||
log.warning("Lost a subscriber for agent " + agent);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
subscriber.unsubscribe(_ctx.getDObjectManager());
|
||||
}
|
||||
_bureauService.agentDestroyed(_ctx.getClient(), agentId);
|
||||
@@ -87,7 +84,8 @@ public abstract class BureauDirector extends BasicDirector
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback for when the a request to subscribe to an object finishes and the object is available.
|
||||
* Callback for when the a request to subscribe to an object finishes and the object is
|
||||
* available.
|
||||
*/
|
||||
protected synchronized void objectAvailable (AgentObject agentObject)
|
||||
{
|
||||
@@ -100,13 +98,12 @@ public abstract class BureauDirector extends BasicDirector
|
||||
agent = createAgent(agentObject);
|
||||
agent.init(agentObject);
|
||||
agent.start();
|
||||
}
|
||||
catch (Throwable t) {
|
||||
} catch (Throwable t) {
|
||||
log.warning("Could not create agent [obj=" + agentObject + "]", t);
|
||||
_bureauService.agentCreationFailed(_ctx.getClient(), oid);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
_agents.put(oid, agent);
|
||||
_bureauService.agentCreated(_ctx.getClient(), oid);
|
||||
}
|
||||
@@ -127,9 +124,8 @@ public abstract class BureauDirector extends BasicDirector
|
||||
// Require the bureau services
|
||||
client.addServiceGroup(BureauCodes.BUREAU_GROUP);
|
||||
|
||||
// Set up our decoder so we can receive method calls
|
||||
// from the server
|
||||
BureauReceiver receiver = new BureauReceiver () {
|
||||
// Set up our decoder so we can receive method calls from the server
|
||||
BureauReceiver receiver = new BureauReceiver() {
|
||||
public void createAgent (int agentId) {
|
||||
BureauDirector.this.createAgent(agentId);
|
||||
}
|
||||
@@ -151,8 +147,8 @@ public abstract class BureauDirector extends BasicDirector
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when it is time to create an Agent. Subclasses should read the
|
||||
* <code>agentObject</code>'s type and/or properties to determine what kind of Agent to
|
||||
* Called when it is time to create an Agent. Subclasses should read the
|
||||
* <code>agentObject</code>'s type and/or properties to determine what kind of Agent to
|
||||
* create.
|
||||
* @param agentObj the distributed and object
|
||||
* @return a new Agent that will govern the distributed object
|
||||
@@ -162,6 +158,6 @@ public abstract class BureauDirector extends BasicDirector
|
||||
protected BureauContext _ctx;
|
||||
protected BureauService _bureauService;
|
||||
protected IntMap<Agent> _agents = IntMaps.newHashIntMap();
|
||||
protected IntMap<SafeSubscriber<AgentObject>> _subscribers =
|
||||
protected IntMap<SafeSubscriber<AgentObject>> _subscribers =
|
||||
IntMaps.newHashIntMap();
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.threerings.presents.client.InvocationReceiver;
|
||||
public interface BureauReceiver extends InvocationReceiver
|
||||
{
|
||||
/**
|
||||
* Creates a new agent. Implementors should create a new {@link Agent} and give it access to
|
||||
* Creates a new agent. Implementors should create a new {@link Agent} and give it access to
|
||||
* the {@link AgentObject} referred to by the <code>agentId</code> parameter and must notify
|
||||
* the service that the agent has been created using {@link BureauService#agentCreated}.
|
||||
* @param client the client receiving the request
|
||||
@@ -38,11 +38,11 @@ public interface BureauReceiver extends InvocationReceiver
|
||||
void createAgent (int agentId);
|
||||
|
||||
/**
|
||||
* Destroys a previously created agent. Implementors should destroy the agent that was created
|
||||
* Destroys a previously created agent. Implementors should destroy the agent that was created
|
||||
* by the call to <code>createAgent</code> with the same agent id and must notify
|
||||
* the service that the agent has been created using {@link BureauService#agentDestroyed}.
|
||||
* @param client the client receiving the request
|
||||
* @param agentId the id of the <code>AgentObject</code> whose <code>Agent</code>
|
||||
* @param agentId the id of the <code>AgentObject</code> whose <code>Agent</code>
|
||||
* should be destroyed
|
||||
*/
|
||||
void destroyAgent (int agentId);
|
||||
|
||||
@@ -24,7 +24,7 @@ package com.threerings.bureau.client;
|
||||
import com.threerings.presents.client.Client;
|
||||
import com.threerings.presents.client.InvocationService;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Interface for the bureau to communicate with the server.
|
||||
*/
|
||||
public interface BureauService extends InvocationService
|
||||
|
||||
Reference in New Issue
Block a user