/** * Invoked from the task scheduled by {@link #scheduleRemoval()} for removing expired * (un)marshallers. If some (un)marshallers remain after execution of this task, then * this method will reschedule a new task for checking again later. */ final void removeExpired() { isRemovalScheduled.set(false); final long now = System.nanoTime(); if (!removeExpired(marshallers, now) | // Really |, not || !removeExpired(unmarshallers, now)) { scheduleRemoval(); } }
/** * Invoked from the task scheduled by {@link #scheduleRemoval()} for removing expired * (un)marshallers. If some (un)marshallers remain after execution of this task, then * this method will reschedule a new task for checking again later. */ final void removeExpired() { isRemovalScheduled.set(false); final long now = System.nanoTime(); if (!removeExpired(marshallers, now) | // Really |, not || !removeExpired(unmarshallers, now)) { scheduleRemoval(); } }
/** * Marks the given marshaller or unmarshaller available for further reuse. * This method: * * <ul> * <li>{@link Pooled#reset(Pooled) Resets} the (un)marshaller to its initial state.</li> * <li>{@linkplain Deque#push(Object) Pushes} the (un)marshaller in the given queue.</li> * <li>Registers a delayed task for disposing expired (un)marshallers after the timeout.</li> * </ul> */ private <T> void recycle(final Deque<T> queue, final T marshaller) { try { ((Pooled) marshaller).reset(template); } catch (JAXBException exception) { /* * Not expected to happen because we are supposed * to reset the properties to their initial values. */ Logging.unexpectedException(Logging.getLogger(Loggers.XML), MarshallerPool.class, "recycle", exception); return; } queue.push(marshaller); scheduleRemoval(); }
/** * Marks the given marshaller or unmarshaller available for further reuse. * This method: * * <ul> * <li>{@link Pooled#reset(Pooled) Resets} the (un)marshaller to its initial state.</li> * <li>{@linkplain Deque#push(Object) Pushes} the (un)marshaller in the given queue.</li> * <li>Registers a delayed task for disposing expired (un)marshallers after the timeout.</li> * </ul> */ private <T> void recycle(final Deque<T> queue, final T marshaller) { try { ((Pooled) marshaller).reset(template); } catch (JAXBException exception) { /* * Not expected to happen because we are supposed * to reset the properties to their initial values. */ Logging.unexpectedException(Logging.getLogger(Loggers.XML), MarshallerPool.class, "recycle", exception); return; } queue.push(marshaller); scheduleRemoval(); }