for (short s : tmp.toArray()) { OSMTag tag = this.idToPoiTag.get(Short.valueOf(s)); if (tag.isRenderable()) {
for (short s : tmp.toArray()) { OSMTag tag = this.idToWayTag.get(Short.valueOf(s)); if (tag.isRenderable()) {
/** {@inheritDoc} */ public short[] toArray() { return toArray( new short[ _size ] ); }
private Object handleOpPushX(CacheLine line, Object extra, int change) { if ((change & LINE_MODIFIED_CHANGED) == 0) { assert line.is(CacheLine.MODIFIED); return PENDING; } if (line.getState().isLessThan(State.E)) { LOG.info("Attempt to push line {} while state is only {}", line.getId(), line.getState()); return null; // throw new IllegalStateException("Line " + line.getId() + " is not owned exclusively by this cache."); } short toNode = (Short) extra; setOwner(line, toNode); final short[] sharers = line.sharers.toArray(); // TODO: maybe S, or, rather, transitional O. We could add this node to sharers and if new owner dies, we become owner here and in the server setState(line, State.I); final List<Message.MSG> pendingMSGs = getAndClearPendingMSGs(line); send(Message.PUTX(toNode, line.id, sharers, pendingMSGs.size(), line.version, readOnly(line.data))); line.rewind(); for (Message.MSG m : getAndClearPendingMSGs(line)) { m = toOutgoing(m, toNode); m.setPending(true); m.setReplyRequired(false); send(m); } fireLineInvalidated(line); return null; }
private int handleMessageGetX(Message.GET msg, CacheLine line) throws IrrelevantStateException { if (handleNotOwner(msg, line)) return 0; relevantStates(line, State.E, State.O); if (line.is(CacheLine.SLAVE)) { if (backup.inv(line.getId(), msg.getNode())) line.set(CacheLine.SLAVE, false); } if (!hasServer && line.is(CacheLine.SLAVE)) line.sharers.add(myNodeId()); final short[] sharers = line.sharers.toArray(); // setState will nullify sharers int change = 0; // TODO: maybe S, or, rather, transitional O. We could add this node to sharers and if new owner dies, we become owner here and in the server change |= setState(line, (hasServer | !line.is(CacheLine.SLAVE)) ? State.I : State.S) ? LINE_STATE_CHANGED : 0; change |= setOwner(line, msg.getNode()) ? LINE_OWNER_CHANGED : 0; final List<Message.MSG> pendingMSGs = getAndClearPendingMSGs(line); send(Message.PUTX(msg, line.id, sharers, pendingMSGs.size(), line.version, readOnly(line.data))); line.rewind(); for (Message.MSG m : pendingMSGs) { m = toOutgoing(m, msg.getNode()); m.setPending(true); m.setReplyRequired(false); send(m); } if (line.getState() == State.I && !line.is(CacheLine.DELETED)) fireLineInvalidated(line); return change; }