Package com.sun.messaging.jmq.jmsserver.util

Examples of com.sun.messaging.jmq.jmsserver.util.ConflictException


        synchronized(Subscription.class) {
             Subscription s = findDurableSubscription(clientID, name);
             if (s != null) {
                String args[] = { name, clientID, duid.toString() };
                throw new ConflictException(
                   Globals.getBrokerResources().getKString(
                        BrokerResources.X_DURABLE_CONFLICT,
                        args));
             }
             try {
View Full Code Here


                       BrokerResources.X_SHUTTING_DOWN_BROKER,
                       (Throwable) null,
                       Status.ERROR );
        }
        if (destinationList.get(duid) != null) {
            throw new ConflictException(
                   Globals.getBrokerResources().getKString(
                        BrokerResources.X_DESTINATION_EXISTS,
                        duid));
        }
        // OK, check the persistent store (required for HA)
        try {
            Store pstore = Globals.getStore();
            Destination d = pstore.getDestination(duid);
            if (d != null) {
                addDestination(d, false);
                return d;
            }
        } catch (Exception ex) {
            // ignore we want to create it
        }
       String lockname = null;

       ClusterBroadcast mbi = Globals.getClusterBroadcast();

       boolean clusterNotify = false;
       Destination d = null;
       try {
            if (DestType.isQueue(type)) {
                d = new Queue(name, type,
                    store, uid, autocreated);
            } else {
                d = new Topic(name, type,
                    store, uid, autocreated);
            }
            d.setClusterNotifyFlag(notify);

            try {
              synchronized (destinationList) {
                    Destination newd = (Destination)destinationList.get(duid);
                    if (newd != null) { // updating existing
                        throw new BrokerException("Destination already exists");
                    }

                    if (!autocreated)
                        d.setIsLocal(localOnly);

                    if (store) {
                        d.store();
                    }
                    destinationList.put(duid, d);

               }
            } catch (BrokerException ex) {
                    // may happen with timing of two brokers in an
                    // HA cluster
                    // if this happens, we should try to re-load the
                    // destination
                    //
                    // so if we get a Broker Exception, throw a new
                    // Conflict message
                    throw new BrokerException(
                        Globals.getBrokerResources().getKString(
                            BrokerResources.X_DESTINATION_EXISTS,
                            d.getName()),
                        BrokerResources.X_DESTINATION_EXISTS,
                        (Throwable) ex,
                        Status.CONFLICT );

            }
            clusterNotify = !d.isAutoCreated() && d.sendClusterUpdate() && notify;

            if (mbi != null && clusterNotify ) { // only null in standalone tonga test
                // prevents two creates at the same time
                // if this is a response to a creation on another broker ..
                // dont worry about locking
                if (!mbi.lockDestination(duid, uid)) {
                     throw new ConflictException("Internal Exception:"
                       + " Destination " + duid + " is in the process"
                       + " of being created");
                }
            }
            if (clusterNotify && mbi != null ) {
View Full Code Here

                       BrokerResources.X_SHUTTING_DOWN_BROKER,
                       (Throwable) null,
                       Status.ERROR );
        }
        if (destinationList.get(duid) != null) {
            throw new ConflictException(
                   Globals.getBrokerResources().getKString(
                        BrokerResources.X_DESTINATION_EXISTS,
                        duid));
        }
        // OK, check the persistent store (required for HA)
        try {
            Store pstore = Globals.getStore();
            Destination d = pstore.getDestination(duid);
            if (d != null) {
                addDestination(d, false);
                return d;
            }
        } catch (Exception ex) {
            // ignore we want to create it
        }
       String lockname = null;

       ClusterBroadcast mbi = Globals.getClusterBroadcast();

       boolean clusterNotify = false;
       Destination d = null;
       try {
            if (DestType.isQueue(type)) {
                d = new Queue(name, type,
                    store, uid, autocreated);
            } else {
                d = new Topic(name, type,
                    store, uid, autocreated);
            }
            d.setClusterNotifyFlag(notify);

            try {
              synchronized (destinationList) {
                    Destination newd = (Destination)destinationList.get(duid);
                    if (newd != null) { // updating existing
                        throw new BrokerException("Destination already exists");
                    }

                    if (!autocreated)
                        d.setIsLocal(localOnly);

                    if (store) {
                        d.store();
                    }
                    destinationList.put(duid, d);

               }
            } catch (BrokerException ex) {
                    // may happen with timing of two brokers in an
                    // HA cluster
                    // if this happens, we should try to re-load the
                    // destination
                    //
                    // so if we get a Broker Exception, throw a new
                    // Conflict message
                    throw new BrokerException(
                        Globals.getBrokerResources().getKString(
                            BrokerResources.X_DESTINATION_EXISTS,
                            d.getName()),
                        BrokerResources.X_DESTINATION_EXISTS,
                        (Throwable) ex,
                        Status.CONFLICT );

            }
            clusterNotify = !d.isAutoCreated() && d.sendClusterUpdate() && notify;

            if (mbi != null && clusterNotify ) { // only null in standalone tonga test
                // prevents two creates at the same time
                // if this is a response to a creation on another broker ..
                // dont worry about locking
                if (!mbi.lockDestination(duid, uid)) {
                     throw new ConflictException("Internal Exception:"
                       + " Destination " + duid + " is in the process"
                       + " of being created");
                }
            }
            if (clusterNotify && mbi != null ) {
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.util.ConflictException

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.