Package com.sun.messaging.jmq.jmsserver.persist

Examples of com.sun.messaging.jmq.jmsserver.persist.ChangeRecordInfo


            List<ChangeRecordInfo> records = ChangeRecord.prepareRestoreRecords(fileName);
            store.clearAllConfigChangeRecords(false);

            Iterator itr = records.iterator();
            ChangeRecordInfo cri = null;
            while (itr.hasNext()) {
                cri = (ChangeRecordInfo)itr.next();
                store.storeConfigChangeRecord(System.currentTimeMillis(), cri.getRecord(), false);
            }

            logger.log(Logger.INFO, br.I_CLUSTER_MB_RESTORE_SUCCESS, fileName);
        }
        catch (Exception e) {
View Full Code Here


                               new Integer(c.getPrefetch()));
                    writeConsumer(c, dos);
                    if (!(c instanceof Subscription)) {
                        continue;
                    }
                    ChangeRecordInfo cri =
                        ((Subscription)c).getCurrentChangeRecordInfo(
                                          ProtocolGlobals.G_NEW_INTEREST);
                    if (cri == null) {
                        continue;
                    }
                    gp.putProp("shareccSeq"+i, cri.getSeq());
                    gp.putProp("shareccUUID"+i, cri.getUUID());
                    gp.putProp("shareccResetUUID"+i, cri.getResetUUID());
                }
                dos.flush();
                bos.flush();
            }
            catch (IOException e) { /* Ignore */ }
View Full Code Here

    public ChangeRecordInfo getShareccInfo(int i) {
        if (pkt.getProp("shareccSeq"+i) == null) {
            return null;
        }
        ChangeRecordInfo cri =  new ChangeRecordInfo();
        cri.setSeq((Long)pkt.getProp("shareccSeq"+i));
        cri.setUUID((String)pkt.getProp("shareccUUID"+i));
        cri.setResetUUID((String)pkt.getProp("shareccResetUUID"+i));
        cri.setType(pkt.getType());
        return cri;
    }
View Full Code Here

    protected GPacket getFirstInfoPacket() {
        if (!Globals.useSharedConfigRecord()) {
            return null;
        }
        ChangeRecordInfo cri = cb.getLastStoredChangeRecord();
        if (cri == null) {
            return null;
        }
        ClusterInfoInfo cii = ClusterInfoInfo.newInstance();
        cii.setLastStoredChangeRecord(cri);
View Full Code Here

                throw new BrokerException("Unexpected "+
                ProtocolGlobals.getPacketTypeDisplayString(gp.getType())+
                " packet from "+link.getRemote());
            }
            ClusterInfoInfo cii = ClusterInfoInfo.newInstance(gp);
            ChangeRecordInfo cri = cii.getLastStoredChangeRecord();
            if (cri == null) {
                return;
            }
            logger.log(logger.INFO, br.getKString(br.I_CLUSTER_RECEIVED_FIRST_INFO,
                ProtocolGlobals.getPacketTypeDisplayString(gp.getType())+
                "[(sharecc)"+cri.toString()+"]", link.getRemote()));

            cb.syncChangeRecordOnJoin(link.getRemote(), cri);

        } catch (Exception e) {
            logger.logStack(logger.ERROR, e.getMessage(), e);
View Full Code Here

        this.pkt = pkt;
        destName = (String) pkt.getProp("N");
        destType = ((Integer) pkt.getProp("DT")).intValue();
        if (pkt.getProp("shareccSeq") != null) {
            shareccInfo =  new ChangeRecordInfo();
            shareccInfo.setSeq((Long)pkt.getProp("shareccSeq"));
            shareccInfo.setUUID((String)pkt.getProp("shareccUUID"));
            shareccInfo.setResetUUID((String)pkt.getProp("shareccResetUUID"));
            shareccInfo.setType(pkt.getType());
        }
View Full Code Here

        gp.putProp("N", d.getDestinationName());
        gp.putProp("DT", new Integer(d.getType()));

        switch (protocol) {
           case ProtocolGlobals.G_REM_DESTINATION:
           ChangeRecordInfo cri = d.getCurrentChangeRecordInfo(
                                  ProtocolGlobals.G_REM_DESTINATION);
           if (cri != null) {
               gp.putProp("shareccSeq", cri.getSeq());
               gp.putProp("shareccUUID", cri.getUUID());
               gp.putProp("shareccResetUUID", cri.getResetUUID());
           }
          
           break;

           case ProtocolGlobals.G_UPDATE_DESTINATION:

           cri = d.getCurrentChangeRecordInfo(
                      ProtocolGlobals.G_UPDATE_DESTINATION);
           if (cri != null) {
               gp.putProp("shareccSeq", cri.getSeq());
               gp.putProp("shareccUUID", cri.getUUID());
               gp.putProp("shareccResetUUID", cri.getResetUUID());
           }

           if (DestType.isTemporary(d.getType())) {
               ConnectionUID cuid = d.getConnectionUID();
               if (cuid != null) {
View Full Code Here

            logger.log(logger.INFO, "handleNewInterest count : " + count);
        }

        try {
            int i = 0;
            ChangeRecordInfo lastcri = null;
            Iterator itr = cci.getConsumers();
            while (itr.hasNext()) {
                i++;
                Consumer cons = null;
                try {
                    cons = (Consumer)itr.next();
                } catch (RuntimeException e) {
                    Throwable ex = e.getCause();
                    if (ex instanceof ConsumerAlreadyAddedException) {
                        logger.log(logger.WARNING, ex.getMessage()+
                        " ("+ProtocolGlobals.getPacketTypeDisplayString(pkt.getType())+") "+sender);
                        continue;
                    }
                    throw e;
                }

                // Make sure that the destination exists...
                DestinationUID duid = cons.getDestinationUID();

                if (duid.isWildcard()) {
                    //we don't need to do anything here
                    // the logic below autocreates the destination
                    // and we need to do that.
                } else {
                    //autocreate the destination if we need to
                int type = (duid.isQueue() ? DestType.DEST_TYPE_QUEUE : DestType.DEST_TYPE_TOPIC);
                Destination dest = Destination.getDestination(duid.getName(), type, true, true);
                }

                cb.interestCreated(cons);
                if (DEBUG) {
                logger.log(logger.INFO, "Added newInterest("+count+")"+cons+ " from "+sender);
                }
                ChangeRecordInfo cri = cci.getShareccInfo(i);
                if (cri != null) {
                    if (lastcri == null) {
                        lastcri = cri;
                    } else if (cri.getSeq().longValue()
                               > lastcri.getSeq().longValue()) {
                        lastcri = cri;
                    }
                }
            }
View Full Code Here

        int count = ((Integer)pkt.getProp("C")).intValue();
        Iterator itr = csi.getSubscriptions();
        try {
            int i = 0;
            ChangeRecordInfo lastcri = null;
            while(itr.hasNext()) {
                i++;
                Subscription intr = (Subscription)itr.next();
                if (intr != null) {
                    cb.unsubscribe(intr);
                }
                ChangeRecordInfo cri = csi.getShareccInfo(i);
                if (cri != null) {
                    if (lastcri == null) {
                        lastcri = cri;
                    } else if (cri.getSeq().longValue()
                               > lastcri.getSeq().longValue()) {
                        lastcri = cri;
                    }
                }
            }
View Full Code Here

            if (changeRecord) {
                gp.putProp("N", subscription.getDurableName());
                gp.putProp("I", subscription.getClientID());
                gp.putProp("M", Boolean.valueOf(true));
            else {
                ChangeRecordInfo cri = subscription.getCurrentChangeRecordInfo(
                                                 ProtocolGlobals.G_NEW_INTEREST);
                if (cri != null) {
                    gp.putProp("shareccSeq"+1, cri.getSeq());
                    gp.putProp("shareccUUID"+1, cri.getUUID());
                    gp.putProp("shareccResetUUID"+1, cri.getResetUUID());
                }
            }
               
            break;


            case ProtocolGlobals.G_DURABLE_ATTACH:
            {
            assert ( consumer != null );

            gp = GPacket.getInstance();
            gp.setType(protocol);

            String dname = subscription.getDurableName();
            if (dname != null) {
            gp.putProp("N", new String(dname));
            }

            String clientID = subscription.getClientID();
            gp.putProp("I", new String(clientID));

            gp.putProp(String.valueOf(consumer.getConsumerUID().longValue())+":"+
                       Consumer.PREFETCH, new Integer(consumer.getPrefetch()));
            gp.putProp("allowsNonDurable", new Boolean(true));
            c.marshalBrokerAddress(c.getSelfAddress(), gp);

            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(bos);
            try {
                ClusterConsumerInfo.writeConsumer(consumer, dos);
                dos.flush();
                bos.flush();
            }
            catch (IOException e) { /* Ignore */ }

            gp.setPayload(ByteBuffer.wrap(bos.toByteArray()));

            }
            break;


            case ProtocolGlobals.G_REM_DURABLE_INTEREST:
            {

            gp = GPacket.getInstance();
            gp.setType(protocol);
      gp.putProp("C", new Integer(1));

            String dname = subscription.getDurableName();
            String clientID = subscription.getClientID();
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            DataOutputStream dos = new DataOutputStream(bos);
            try {
                dos.writeUTF(dname);
                dos.writeUTF(clientID);
                dos.flush();
                bos.flush();
            }
            catch (IOException e) { /* Ignore */ }

            gp.setPayload(ByteBuffer.wrap(bos.toByteArray()));

            if (changeRecord) {
                gp.putProp("N", new String(dname));
                gp.putProp("I", new String(clientID));
                gp.putProp("M", new Boolean(true));
            } else {
                ChangeRecordInfo cri = subscription.getCurrentChangeRecordInfo(
                                           ProtocolGlobals.G_REM_DURABLE_INTEREST);
                if (cri != null) {
                    gp.putProp("shareccSeq"+1, cri.getSeq());
                    gp.putProp("shareccUUID"+1, cri.getUUID());
                    gp.putProp("shareccResetUUID"+1, cri.getResetUUID());
                }
            }

            }
            break;
View Full Code Here

TOP

Related Classes of com.sun.messaging.jmq.jmsserver.persist.ChangeRecordInfo

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.