To Bernard:
I've noticed that the line will get stuck is the "updateRenderState".
Below I show part of error messages:
java.util.EmptyStackException
at java.util.Stack.peek(Unknown Source)
at java.util.Stack.pop(Unknown Source)
at com.jme.scene.Spatial.updateRenderState(Spatial.java:1670)
at com.jme.scene.Node.applyRenderState(Node.java:604)
at com.jme.scene.Spatial.updateRenderState(Spatial.java:1663)
at com.jme.scene.Node.applyRenderState(Node.java:604)
at com.jme.scene.Spatial.updateRenderState(Spatial.java:1663)
at com.jme.scene.Spatial.updateRenderState(Spatial.java:1632)
at
org.jdesktop.wonderland.modules.mathroom.client.jme.cellrenderer.TableCellRenderer
$3.run(TableCellRenderer.java:560)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown
Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown
Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
To Bob:
Yes, both the server side and client side contain boxes'
List<Vector3f> location. Do I need to send a SYNC message to sever
side in the Cell's setStatus method? I mean I do this:
public void setStatus(CellStatus status, boolean increasing) {
super.setStatus(status, increasing);
................
TableCellChangeMessage msg = new TableCellChangeMessage(getCellID());
msg.setAction(Action.SYNC);
sendCellMessage(msg);
.....
}
And server send back the location of all boxes to let client use
CellRender to add boxes.
In Cell : case SYNC:
if
(sccm.getSenderID().equals(getCellCache().getSession().getID())) {
renderer.sync(sccm.getBoxesLocation());
In Renderer:
public void sync(List<Vector3f> boxesLocation) {
for (Vector3f location : boxesLocation) {
addObject(location);
}
}
public void addObject(final Vector3f location) {
final Runnable run = new Runnable() {
public final void run() {
if (boxes == null) {
boxes = new ArrayList<Node>();
}
int id = boxes.size();
Node boxNode = createObject(id, location);
boxes.add(boxNode);
ClientContextJME.getWorldManager().addToUpdateList(boxNode);
collisionSystem.addReportingNode(boxNode, cc);
tableNode.attachChild(boxNode);
try {
tableNode.updateRenderState();
} catch (Throwable t) {
Logger.getLogger(TableCellRenderer.class.getName()).log(Level.WARNING,
null, t);
}
}
};
SwingUtilities.invokeLater(run);
Is it right to send SYNCHONIZE message to server in Cell's setStatus
method? Will this action cause synchronizing twice?