本文整理了Java中com.sun.xml.ws.api.streaming.XMLStreamReaderFactory.recycle()
方法的一些代码示例,展示了XMLStreamReaderFactory.recycle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XMLStreamReaderFactory.recycle()
方法的具体详情如下:
包路径:com.sun.xml.ws.api.streaming.XMLStreamReaderFactory
类名称:XMLStreamReaderFactory
方法名:recycle
[英]Should be invoked when the code finished using an XMLStreamReader.
If the recycled instance implements RecycleAware, RecycleAware#onRecycled() will be invoked to let the instance know that it's being recycled.
It is not a hard requirement to call this method on every XMLStreamReaderinstance. Not doing so just reduces the performance by throwing away possibly reusable instances. So the caller should always consider the effort it takes to recycle vs the possible performance gain by doing so.
This method may be invoked by multiple threads concurrently.
[中]应在代码使用完XMLStreamReader后调用。
如果回收的实例实现了RecycleAware,则将调用RecycleAware#onRecycled(),让实例知道它正在被回收。
在每个XMLStreamReaderinstance上调用此方法并不难。不这样做只会因为丢弃可能可重用的实例而降低性能。因此,呼叫者应该总是考虑通过这样做来回收可能的性能增益所付出的努力。
多个线程可以同时调用此方法。
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
public void onRecycled() {
XMLStreamReaderFactory.recycle(reader);
reader = null;
}
代码示例来源:origin: javaee/metro-jax-ws
public void onRecycled() {
XMLStreamReaderFactory.recycle(reader);
reader = null;
}
代码示例来源:origin: com.hynnet/xws-security
@Override
public void consume() {
assert unconsumed();
XMLStreamReaderFactory.recycle(reader);
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
/**
* Default implementation that copies the infoset. Not terribly efficient.
*/
public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException {
XMLStreamReader xsr = readHeader();
WSEndpointReference epr = new WSEndpointReference(xsr, expected);
XMLStreamReaderFactory.recycle(xsr);
return epr;
}
代码示例来源:origin: com.sun.xml.ws/rt
/**
* Default implementation that copies the infoset. Not terribly efficient.
*/
public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException {
XMLStreamReader xsr = readHeader();
WSEndpointReference epr = new WSEndpointReference(xsr, expected);
XMLStreamReaderFactory.recycle(xsr);
return epr;
}
代码示例来源:origin: javaee/metro-jax-ws
/**
* Default implementation that copies the infoset. Not terribly efficient.
*/
public WSEndpointReference readAsEPR(AddressingVersion expected) throws XMLStreamException {
XMLStreamReader xsr = readHeader();
WSEndpointReference epr = new WSEndpointReference(xsr, expected);
XMLStreamReaderFactory.recycle(xsr);
return epr;
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
@Override
public void consume() {
assert unconsumed();
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
private void writeEPRExtensions(Collection<WSEndpointReference.EPRExtension> eprExtns) throws XMLStreamException {
if (eprExtns != null) {
for (WSEndpointReference.EPRExtension e : eprExtns) {
XMLStreamReaderToXMLStreamWriter c = new XMLStreamReaderToXMLStreamWriter();
XMLStreamReader r = e.readAsXMLStreamReader();
c.bridge(r, writer);
XMLStreamReaderFactory.recycle(r);
}
}
}
代码示例来源:origin: javaee/metro-jax-ws
@Override
public void consume() {
assert unconsumed();
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
}
代码示例来源:origin: com.sun.xml.ws/rt
@Override
public void consume() {
assert unconsumed();
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
}
代码示例来源:origin: javaee/metro-jax-ws
private void writeEPRExtensions(Collection<WSEndpointReference.EPRExtension> eprExtns) throws XMLStreamException {
if (eprExtns != null) {
for (WSEndpointReference.EPRExtension e : eprExtns) {
XMLStreamReaderToXMLStreamWriter c = new XMLStreamReaderToXMLStreamWriter();
XMLStreamReader r = e.readAsXMLStreamReader();
c.bridge(r, writer);
XMLStreamReaderFactory.recycle(r);
}
}
}
代码示例来源:origin: com.sun.xml.ws/rt
private void writeEPRExtensions(Collection<WSEndpointReference.EPRExtension> eprExtns) throws XMLStreamException {
if (eprExtns != null) {
for (WSEndpointReference.EPRExtension e : eprExtns) {
XMLStreamReaderToXMLStreamWriter c = new XMLStreamReaderToXMLStreamWriter();
XMLStreamReader r = e.readAsXMLStreamReader();
c.bridge(r, writer);
XMLStreamReaderFactory.recycle(r);
}
}
}
代码示例来源:origin: com.hynnet/xws-security
public Object run() throws Exception {
if (hasAttachments()) {
unmarshaller.setAttachmentUnmarshaller(new AttachmentUnmarshallerImpl(getAttachments()));
}
try {
return unmarshaller.unmarshal(reader);
} finally {
unmarshaller.setAttachmentUnmarshaller(null);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
}
}
});
代码示例来源:origin: com.sun.xml.ws/rt
/** @deprecated */
public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: javaee/metro-jax-ws
public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
/** @deprecated */
public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: com.sun.xml.ws/jaxws-rt
public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: javaee/metro-jax-ws
/** @deprecated */
public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: com.sun.xml.ws/rt
public <T> T readPayloadAsJAXB(XMLBridge<T> bridge) throws JAXBException {
if(!hasPayload())
return null;
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.readRest(reader);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
代码示例来源:origin: com.hynnet/xws-security
public <T> T readPayloadAsJAXB(Bridge<T> bridge) throws JAXBException {
cacheMessage();
if (!hasPayload()) {
return null;
}
assert unconsumed();
T r = bridge.unmarshal(reader,
hasAttachments() ? new AttachmentUnmarshallerImpl(getAttachments()) : null);
XMLStreamReaderUtil.close(reader);
XMLStreamReaderFactory.recycle(reader);
return r;
}
内容来源于网络,如有侵权,请联系作者删除!