Search in sources :

Example 11 with ProtocolException

use of org.apache.nifi.cluster.protocol.ProtocolException in project nifi by apache.

the class BulletinsPayload method marshal.

public static void marshal(final BulletinsPayload payload, final OutputStream os) throws ProtocolException {
    try {
        final Marshaller marshaller = JAXB_CONTEXT.createMarshaller();
        marshaller.marshal(payload, os);
    } catch (final JAXBException je) {
        throw new ProtocolException(je);
    }
}
Also used : ProtocolException(org.apache.nifi.cluster.protocol.ProtocolException) Marshaller(javax.xml.bind.Marshaller) JAXBException(javax.xml.bind.JAXBException)

Example 12 with ProtocolException

use of org.apache.nifi.cluster.protocol.ProtocolException in project nifi by apache.

the class BulletinsPayload method unmarshal.

public static BulletinsPayload unmarshal(final InputStream is) throws ProtocolException {
    try {
        final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller();
        final XMLStreamReader xsr = XmlUtils.createSafeReader(is);
        return (BulletinsPayload) unmarshaller.unmarshal(xsr);
    } catch (final JAXBException | XMLStreamException e) {
        throw new ProtocolException(e);
    }
}
Also used : ProtocolException(org.apache.nifi.cluster.protocol.ProtocolException) XMLStreamReader(javax.xml.stream.XMLStreamReader) XMLStreamException(javax.xml.stream.XMLStreamException) JAXBException(javax.xml.bind.JAXBException) Unmarshaller(javax.xml.bind.Unmarshaller)

Aggregations

ProtocolException (org.apache.nifi.cluster.protocol.ProtocolException)12 IOException (java.io.IOException)7 ProtocolMessage (org.apache.nifi.cluster.protocol.message.ProtocolMessage)5 Socket (java.net.Socket)4 NoClusterCoordinatorException (org.apache.nifi.cluster.exception.NoClusterCoordinatorException)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 InetSocketAddress (java.net.InetSocketAddress)2 JAXBException (javax.xml.bind.JAXBException)2 NodeIdentifier (org.apache.nifi.cluster.protocol.NodeIdentifier)2 ReconnectionResponseMessage (org.apache.nifi.cluster.protocol.message.ReconnectionResponseMessage)2 InputStream (java.io.InputStream)1 ExecutorService (java.util.concurrent.ExecutorService)1 ThreadFactory (java.util.concurrent.ThreadFactory)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Marshaller (javax.xml.bind.Marshaller)1 Unmarshaller (javax.xml.bind.Unmarshaller)1 XMLStreamException (javax.xml.stream.XMLStreamException)1 XMLStreamReader (javax.xml.stream.XMLStreamReader)1 RetryPolicy (org.apache.curator.RetryPolicy)1 CuratorFramework (org.apache.curator.framework.CuratorFramework)1