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

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


    public void takeoverBroker(String brokerID, boolean force)
        throws BrokerException
    {
        ClusterManager cm = Globals.getClusterManager();
        if (!cm.isHA()) {
            throw new BrokerException(
               Globals.getBrokerResources().getKString(
               BrokerResources.X_NONHA_NO_TAKEOVER_SUPPORT));
        } else {
            HAClusteredBroker hcb = (HAClusteredBroker)
                          cm.getBroker(brokerID);
            if (hcb == null) {
                throw new BrokerException(
                    Globals.getBrokerResources().getKString(
                    BrokerResources.X_UNKNOWN_BROKERID, brokerID));
            } else if (hcb.isLocalBroker()) {
                throw new BrokerException(
                    Globals.getBrokerResources().getKString(
                    BrokerResources.X_CANNOT_TAKEOVER_SELF));
            } else {
                Globals.getHAMonitorService().takeoverBroker(hcb, force);
            }
View Full Code Here


             logger.log(Logger.INFO, BrokerResources.I_UNQUIESCE_DONE);
         } catch (Exception ex) {
              Globals.getLogger().logStack(Logger.WARNING,
                       BrokerResources.E_INTERNAL_BROKER_ERROR,
                       "exception during unquiesce", ex);
              throw new BrokerException(
                       Globals.getBrokerResources().getKString(
                          BrokerResources.E_INTERNAL_BROKER_ERROR,
                          "unable to unquiesce"), ex);
         }
    }
View Full Code Here

                // stop accepting new jms threads
                ServiceManager sm = Globals.getServiceManager();
                sm.stopNewConnections(ServiceType.NORMAL);
            } catch (Exception ex) {
                throw new BrokerException(
                    BrokerResources.X_QUIESCE_FAILED, ex);
            }
        }
View Full Code Here

    }


    public static UID getStoreSession() throws BrokerException{
        if (HAStoreSession == null || HAStoreSession.longValue() == -1) {
            throw new BrokerException(
            BrokerResources.E_INTERNAL_ERROR, "HA store session UID has not been initialized");
        }
        return HAStoreSession;
    }
View Full Code Here

                } catch (Exception ex) {
                    if (ex instanceof BrokerException) {
                        // Just re-throw the exception
                        throw (BrokerException)ex;
                    }
                    throw new BrokerException(
                       Globals.getBrokerResources().getKString(
                        BrokerResources.E_INITING_CLUSTER),ex);
                }
            }
        }
View Full Code Here

            // check for the case where the trial license file is not
            // writable (fix for bug 4478642)
            fos = new FileOutputStream(file);
        } catch (IOException e) {
            if (file.exists() && !file.canWrite()) {
                throw new BrokerException(
                    br.getString(br.E_LICENSE_FILE_NOT_WRITABLE, file));
            } else {
                throw e;
            }
        }
View Full Code Here

            DataInputStream dis = new DataInputStream(fis);

            // Check the magic number.
            long magic = dis.readLong();
            if (magic != LICENSE_MAGIC_NUMBER)
                throw new BrokerException(
                    br.getString(br.E_BAD_LICENSE_DATA));

            // Checksum
            byte[] checksum = new byte[CHECKSUM_LEN];
            dis.readFully(checksum);

            // read data
            int fakesize = dis.readInt();
            int size = fakesize/BLOW_FACTOR;

            int cut = size/CUT_FACTOR;

            byte[] data = new byte[size];

            // read the first half
            dis.read(data, 0, cut);

            // skip middle section
            dis.skipBytes(size * FAKE_FACTOR);

            // read the second half
            dis.read(data, cut, size - cut);
            dis.close();
            fis.close();

            // check checksum
            digest.reset();
            byte[] computed = digest.digest(data);

            if (!goodChecksum(checksum, computed)) {
                throw new BrokerException(
                    br.getString(br.E_BAD_LICENSE_DATA));
            }

            // unscramble and parse data
            parseData(scramble(data));
        } catch (IOException e) {
            throw new BrokerException(br.getString(br.E_BAD_LICENSE_DATA), e);
        }
    }
View Full Code Here

            Properties tmp = new Properties();
            tmp.load(bais);
            superimpose(tmp);
        }
        catch (Exception e) {
            throw new BrokerException("Bad license.", e);
        }
    }
View Full Code Here

    // Step 1 : Choose the best LicenseBase implementation class.
    base = getLicenseBase();
    if (base == null) {
            // No license base class in the package!
            // This should never happen. No I18N necessary.
            throw new BrokerException(
                "Could not find license base class." +
                "This is a broker packaging error.");
        }

        // Step 2 : Load the specified license file. If no license
        // file is specified, load all license files and select the
        // one that is most generous.
        FileLicense fl = null;
        try {
            fl = loadLicenseFile(filestr);
       }
        catch (BrokerException e) {
           //BUG FIX 5025985
           throw e;
        }

        // Step 3 : If a license file was loaded from the disk
        // it must be re-written in order to handle the license
        // expiration correctly.
        if (fl != null) {
            try {
                fl.rewriteLicense();
            } catch (IOException e) {
                throw new BrokerException(
                    br.getString(br.E_BAD_LICENSE_DATA), e);
            }
        }

        // Step 4 : Superimpose the license file contents on the
        // base class chosen in step 1.
        if (fl != null) {
            if (filestr != null ||
                fl.getPrecedence() > base.getPrecedence()) {
                base.superimpose(fl.getProperties());

                // log where the license comes from
                logger.log(Logger.DEBUG, br.getString(br.I_LICENSE_FILE,
                        fl.getLicenseFile()));
            }
        }
        else if (base.isLicenseFileRequired()) {
            // If there is no license file, and the base class
            // requires a license file, throw an exception.
            throw new BrokerException(
                br.getString(br.E_NO_VALID_LICENSE));
        }

        currentLicense = base;
        return base;
View Full Code Here

     * Select the most generous license.
     */
    private LicenseBase selectBestLicense(LicenseBase[] licenses)
        throws BrokerException {
        if (licenses == null || licenses.length == 0) {
            throw new BrokerException(
                br.getString(br.E_NO_VALID_LICENSE));
        }

        // pick a license to use:
        // - pick the one with the highest precedence value.
View Full Code Here

TOP

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

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.