Package org.apache.activemq.command

Examples of org.apache.activemq.command.WireFormatInfo


    private boolean sizePrefixDisabled;
    private long maxInactivityDuration = 30 * 1000;
    private int cacheSize = 1024;

    public WireFormat createWireFormat() {
        WireFormatInfo info = new WireFormatInfo();
        info.setVersion(version);

        try {
            info.setStackTraceEnabled(stackTraceEnabled);
            info.setCacheEnabled(cacheEnabled);
            info.setTcpNoDelayEnabled(tcpNoDelayEnabled);
            info.setTightEncodingEnabled(tightEncodingEnabled);
            info.setSizePrefixDisabled(sizePrefixDisabled);
            info.seMaxInactivityDuration(maxInactivityDuration);
            info.setCacheSize(cacheSize);
        } catch (Exception e) {
            IllegalStateException ise = new IllegalStateException("Could not configure WireFormatInfo");
            ise.initCause(e);
            throw ise;
        }
View Full Code Here


    public void start() throws Exception {
        super.start();
        if (firstStart.compareAndSet(true, false)) {
            try {
                WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Sending: " + info);
                }
                sendWireFormat(info);
            } finally {
View Full Code Here

    }

    public void onCommand(Object o) {
        Command command = (Command)o;
        if (command.isWireFormatInfo()) {
            WireFormatInfo info = (WireFormatInfo)command;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Received WireFormat: " + info);
            }

            try {
                wireInfoSentDownLatch.await();

                if (LOG.isDebugEnabled()) {
                    LOG.debug(this + " before negotiation: " + wireFormat);
                }
                if (!info.isValid()) {
                    onException(new IOException("Remote wire format magic is invalid"));
                } else if (info.getVersion() < minimumVersion) {
                    onException(new IOException("Remote wire format (" + info.getVersion() + ") is lower the minimum version required (" + minimumVersion + ")"));
                }

                wireFormat.renegotiateWireFormat(info);
                Socket socket = next.narrow(Socket.class);
                if (socket != null) {
View Full Code Here

        // Read the command directly from the reader, assuming UTF8 encoding
        ServletInputStream sis = request.getInputStream();
        Command command = (Command) wireFormat.unmarshalText(new InputStreamReader(sis, "UTF-8"));

        if (command instanceof WireFormatInfo) {
            WireFormatInfo info = (WireFormatInfo) command;
            if (!canProcessWireFormatVersion(info.getVersion())) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: "
                        + info.getVersion());
            }

        } else {

            BlockingQueueTransport transport = getTransportChannel(request, response);
View Full Code Here

    public void start() throws Exception {
        super.start();
        if (firstStart.compareAndSet(true, false)) {
            try {
                WireFormatInfo info = wireFormat.getPreferedWireFormatInfo();
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Sending: " + info);
                }
                sendWireFormat(info);
            } finally {
View Full Code Here

    }

    public void onCommand(Object o) {
        Command command = (Command)o;
        if (command.isWireFormatInfo()) {
            WireFormatInfo info = (WireFormatInfo)command;
            if (LOG.isDebugEnabled()) {
                LOG.debug("Received WireFormat: " + info);
            }

            try {
                wireInfoSentDownLatch.await();

                if (LOG.isDebugEnabled()) {
                    LOG.debug(this + " before negotiation: " + wireFormat);
                }
                if (!info.isValid()) {
                    onException(new IOException("Remote wire format magic is invalid"));
                } else if (info.getVersion() < minimumVersion) {
                    onException(new IOException("Remote wire format (" + info.getVersion() + ") is lower the minimum version required (" + minimumVersion + ")"));
                }

                wireFormat.renegotiateWireFormat(info);
                Socket socket = next.narrow(Socket.class);
                if (socket != null) {
View Full Code Here

        // Read the command directly from the reader, assuming UTF8 encoding
        Command command = (Command) wireFormat.unmarshalText(new InputStreamReader(stream, "UTF-8"));

        if (command instanceof WireFormatInfo) {
            WireFormatInfo info = (WireFormatInfo) command;
            if (!canProcessWireFormatVersion(info.getVersion())) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: "
                        + info.getVersion());
            }

        } else {

            BlockingQueueTransport transport = getTransportChannel(request, response);
View Full Code Here

            public void transportResumed() {
            }
        });
        clientTransport.start();
        WireFormatInfo info = new WireFormatInfo();
        info.setVersion(OpenWireFormat.DEFAULT_VERSION);
        info.setMaxInactivityDuration(1000);
        clientTransport.oneway(info);

        assertEquals(0, serverErrorCount.get());
        assertEquals(0, clientErrorCount.get());
View Full Code Here

        // Read the command directly from the reader, assuming UTF8 encoding
        ServletInputStream sis = request.getInputStream();
        Command command = (Command) wireFormat.unmarshalText(new InputStreamReader(sis, "UTF-8"));

        if (command instanceof WireFormatInfo) {
            WireFormatInfo info = (WireFormatInfo) command;
            if (!canProcessWireFormatVersion(info.getVersion())) {
                response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: "
                        + info.getVersion());
            }

        } else {

            BlockingQueueTransport transport = getTransportChannel(request, response);
View Full Code Here

    private long maxInactivityDuration = 30*1000;
    private long maxInactivityDurationInitalDelay = 10*1000;
    private int cacheSize = 1024;

    public WireFormat createWireFormat() {
        WireFormatInfo info = new WireFormatInfo();
        info.setVersion(version);

        try {
            info.setStackTraceEnabled(stackTraceEnabled);
            info.setCacheEnabled(cacheEnabled);
            info.setTcpNoDelayEnabled(tcpNoDelayEnabled);
            info.setTightEncodingEnabled(tightEncodingEnabled);
            info.setSizePrefixDisabled(sizePrefixDisabled);
            info.setMaxInactivityDuration(maxInactivityDuration);
            info.setMaxInactivityDurationInitalDelay(maxInactivityDurationInitalDelay);
            info.setCacheSize(cacheSize);
        } catch (Exception e) {
            IllegalStateException ise = new IllegalStateException("Could not configure WireFormatInfo");
            ise.initCause(e);
            throw ise;
        }
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.WireFormatInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.