Examples of SFSBBeanState


Examples of com.sun.ejb.spi.sfsb.SFSBBeanState

    }

    public SFSBBeanState getState(Object sessionKey) {

        String fileName = sessionKey.toString();
        SFSBBeanState beanState = null;

  if(_logger.isLoggable(TRACE_LEVEL)) {
      _logger.log(TRACE_LEVEL, "[SFSBStore] Attempting to load session: "
          + sessionKey);
  }

        if (passivatedSessions.remove(fileName) == null) {
      if(_logger.isLoggable(TRACE_LEVEL)) {
    _logger.log(TRACE_LEVEL, "[SFSBStore] Could not find "
      + "state for session: " + sessionKey);
      }
            return null;
        }

        File file = new File(baseDir, fileName);
        if (file.exists()) {
            int dataSize = (int) file.length();
            byte[] data = new byte[dataSize];
            BufferedInputStream bis = null;
            FileInputStream fis = null;
            try {
                loadCount++;
                fis = new FileInputStream(file);
                bis = new BufferedInputStream(fis);
                int offset = 0;
                for (int toRead = dataSize; toRead > 0; ) {
                    int count = bis.read(data, offset, toRead);
                    offset += count;
                    toRead -= count;
               
       
                beanState = new SFSBBeanState(sessionKey, -1, false, data);
                loadSuccessCount++;
    if(_logger.isLoggable(TRACE_LEVEL)) {
        _logger.log(TRACE_LEVEL, "[SFSBStore] Successfully Loaded "
          + "session: " + sessionKey);
    }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

  }
    }

    SFSBBeanState getSFSBBeanState(SessionContextImpl sc) {
  //No need to synchronize
  SFSBBeanState sfsbBeanState = null;
  try {
           
            if ((containerState != CONTAINER_STARTED) && (containerState != CONTAINER_STOPPED)) {
    _logger.log(Level.FINE, "getSFSBBeanState() returning because "
      + "containerState: " + containerState);
                return null;
            }

            if (sc.getState() == DESTROYED) {
                return null;
      }
           
            Object ejb = sc.getEJB();
           
            ComponentInvocation ci = new ComponentInvocation(ejb, this, sc);
            invocationManager.preInvoke(ci);

            synchronized (sc) {
                try {
                    interceptorManager.intercept(
                            CallbackType.PRE_PASSIVATE, sc);
        sc.setLastPersistedAt(System.currentTimeMillis());
                    long newCtxVersion = sc.incrementAndGetVersion();
        byte[] serializedState = IOUtils.serializeObject(sc, true);
        sfsbBeanState = sfsbStoreManager.createSFSBBeanState(
      sc.getInstanceKey(), System.currentTimeMillis(),
      !sc.existsInStore(), serializedState);
        sfsbBeanState.setVersion(newCtxVersion);
                    interceptorManager.intercept(
                            CallbackType.POST_ACTIVATE, sc);
        //Do not set sc.setExistsInStore() here
                } catch (java.io.NotSerializableException serEx) {
                    _logger.log(Level.WARNING, "Error  during checkpoint ("
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

        sc.setLastPersistedAt(System.currentTimeMillis());
        byte[] serializedState = null;
        try {
                        long newCtxVersion = sc.incrementAndGetVersion();
            serializedState = IOUtils.serializeObject(sc, true);
            SFSBBeanState beanState =
      sfsbStoreManager.createSFSBBeanState(
        sc.getInstanceKey(), sc.getLastAccessTime(),
        !sc.existsInStore(), serializedState);
                        beanState.setVersion(newCtxVersion);
      sfsbStoreManager.checkpointSave(beanState);

      //Now that we have successfully stored.....
           
      sc.setLastPersistedAt(System.currentTimeMillis());
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

  for (int i=0; i<size; i++) {
      SessionContextImpl ctx = contexts[i];
      StatefulSessionContainer container =
    (StatefulSessionContainer) ctx.getContainer();
      SFSBBeanState beanState = container.getSFSBBeanState(ctx);
      if (beanState != null) {
    states.add(beanState);
      }
  }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

    /** A Factory method to create a SFSBBeanState. The StoreManager
     *   is responsible for filling the SFSBBeanState with the
     *   correct ClusterId, containerId and SFSBStoreManager
     */
    public SFSBBeanState createSFSBBeanState(Object sessionId, long lastAccess, boolean isNew, byte[] state) {
        return new SFSBBeanState(
            this.getClusterID(),
            containerID,  //long
            sessionId,
            lastAccess,
            isNew,
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

            _logger.entering("ReplicatedSFSBStoreManager", "getState", id);
        }
        if(id == null) {
            return null;
        }
        SFSBBeanState sfsbState = null;
        //try first in locally passivated cache before going to backup
        sfsbState= this.getFromLocallyPassivatedCache(id.toString());
        if(sfsbState != null) {
            return sfsbState;
        }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

            store = getStore();           
            ( (ReplicatedEjbStore) store).save(beanStates, startTime);
            //added for monitoring
            if(this.isMonitoringEnabled()) {
                for(int i=0; i<beanStates.length; i++) {
                    SFSBBeanState nextBeanState = beanStates[i];
                    stats.processBeanSize(this.getBeanSize(nextBeanState));
                }
            }
            //end added for monitoring          
        }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

   
    private Long[] storeOriginalTxCheckpointDurations(SFSBBeanState[] beanStates) {   
        //return temporarily stored original txCheckpointDurations
        Long[] originalTxCheckpointDurations = new Long[beanStates.length];
        for(int i=0; i<beanStates.length; i++) {
            SFSBBeanState nextBeanState = beanStates[i];
            originalTxCheckpointDurations[i] =
                new Long(nextBeanState.getTxCheckpointDuration());
        }
        return originalTxCheckpointDurations;
    }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

   
    private void restoreOriginalTxCheckpointDurations(SFSBBeanState[] beanStates, Long[] originalTxCheckpointDurations) {   
        //restore temporarily stored original txCheckpointDurations
        //to beanStates from originalTxCheckpointDurations
        for(int i=0; i<beanStates.length; i++) {
            SFSBBeanState nextBeanState = beanStates[i];
            long originalDuration = originalTxCheckpointDurations[i].longValue();
            nextBeanState.setTxCheckpointDuration(originalDuration);
        }
        return;
    }
View Full Code Here

Examples of com.sun.ejb.spi.sfsb.store.SFSBBeanState

    private void printTxCheckpointDurations(SFSBBeanState[] beanStates) {   
        //used for testing
        if (_logger.isLoggable(Level.FINE)) {
            _logger.fine("Printing Checkpoint Durations");
            for(int i=0; i<beanStates.length; i++) {
                SFSBBeanState nextBeanState = beanStates[i];
                _logger.fine("printTxCheckpointDurations for beanState[" + i + "]: "
                             + nextBeanState.getTxCheckpointDuration());
            }
        }
        return;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.