Package com.persistit

Examples of com.persistit.Management


            if (_refreshing)
                return;
            _refreshing = true;
        }
        try {
            Management management = _management;
            if (management != null) {
                try {
                    management.isInitialized();
                } catch (final RemoteException re) {
                    disconnect();
                    management = null;
                }
            }
View Full Code Here


        return _management;
    }

    @Override
    public void setManagement(final Management newManagement) {
        final Management oldManagement = _management;
        if (oldManagement != null) {
            unfreeze(oldManagement);
        }
        _management = newManagement;
        SwingUtilities.invokeLater(this);
View Full Code Here

    }

    private boolean connect(final String rmiHost) {
        try {
            _rmiHost = rmiHost;
            final Management management = (Management) Naming.lookup("//" + rmiHost + "/PersistitManagementServer");
            setManagement(management);
            setFrameTitle(rmiHost);
            return true;
        } catch (final Exception e) {
            setManagement(null);
View Full Code Here

    public void actionPerformed(final AdminAction action, final ActionEvent ae) {
        try {
            final String name = action._name;
            boolean textModeChanged = false;
            // System.out.println("AdminUI actionPerformed: " + name);
            final Management management = _management;

            if (name.startsWith("REFRESH")) {
                int interval = 0;
                if (name.startsWith("REFRESH_")) {
                    interval = Integer.parseInt(name.substring("REFRESH_".length()));
                }
                scheduleRefresh(interval);
            } else if ("EXIT".equals(name)) {
                setManagement(null);
                close();
            } else if ("CONNECT".equals(name)) {
                connectDialog(_rmiHost);
            } else if ("DISCONNECT".equals(name)) {
                disconnect();
            } else if ("ABOUT".equals(name)) {
                if (_splashWindow == null) {
                    _splashWindow = new SplashWindow(_frame);
                    _splashWindow.display();
                }
            } else if ("HELP".equals(name)) {
                showHelp(ae);
            } else if ("SSUSP".equals(name)) {
                boolean state = ((AbstractButton) ae.getSource()).isSelected();
                if (management != null && management.isInitialized()) {
                    if (state) {
                        final int confirm = JOptionPane.showConfirmDialog(_frame, getProperty("ssusp.confirm"));

                        if (confirm != JOptionPane.YES_OPTION) {
                            state = false;
                        }
                    }

                    management.setShutdownSuspended(state);
                    scheduleRefresh(-1);
                } else {
                    ((AbstractButton) ae.getSource()).setSelected(false);
                }
            } else if ("USUSP".equals(name)) {
                boolean state = ((AbstractButton) ae.getSource()).isSelected();
                if (management != null && management.isInitialized()) {
                    if (state) {

                        final int confirm = JOptionPane.showConfirmDialog(_frame, getProperty("ususp.confirm"));

                        if (confirm != JOptionPane.YES_OPTION) {
                            state = false;
                        }
                    }
                    management.setUpdateSuspended(state);
                    scheduleRefresh(-1);
                } else {
                    ((AbstractButton) ae.getSource()).setSelected(false);
                }
            } else if ("AONLY".equals(name)) {
                boolean state = ((AbstractButton) ae.getSource()).isSelected();
                if (management != null && management.isInitialized()) {
                    if (state) {

                        final int confirm = JOptionPane.showConfirmDialog(_frame, getProperty("aonly.confirm"));

                        if (confirm != JOptionPane.YES_OPTION) {
                            state = false;
                        }
                    }
                    management.setAppendOnly(state);
                    scheduleRefresh(-1);
                } else {
                    ((AbstractButton) ae.getSource()).setSelected(false);
                }
            } else if ("JCOPY".equals(name)) {
                boolean state = ((AbstractButton) ae.getSource()).isSelected();
                if (management != null && management.isInitialized()) {
                    if (state) {

                        final int confirm = JOptionPane.showConfirmDialog(_frame, getProperty("jcopy.confirm"));

                        if (confirm != JOptionPane.YES_OPTION) {
                            state = false;
                        }
                    }
                    management.setJournalCopyingFast(state);
                    scheduleRefresh(-1);
                } else {
                    ((AbstractButton) ae.getSource()).setSelected(false);
                }
            } else if ("FLUSH".equals(name)) {
                if (management != null && management.isInitialized()) {
                    management.flushAndForce();
                }
                // } else if ("SHUTDOWN".equals(name)) {
                // if (management != null && management.isInitialized()) {
                // int confirm = JOptionPane.showConfirmDialog(_frame,
                // getProperty("shutdown.confirm"));
View Full Code Here

            _refreshTimer.schedule(_refreshTimerTask, 0);
        }
    }

    protected void doTask(final TaskSetupPanel tsp) throws RemoteException {
        final Management management = getManagement();
        if (management != null) {
            // TODO - reinstate task interface
            management.startTask(tsp.getDescriptionString(), tsp.getOwnerString(), tsp.getCommandLine(),
                    tsp.getExpirationTime(), tsp.isVerboseEnabled() ? Task.LOG_VERBOSE : Task.LOG_NORMAL);
        }
        scheduleRefresh(1000);
    }
View Full Code Here

            _logicalRecord = lr;
        }

        @Override
        public void run() {
            final Management management = _adminUI.getManagement();
            if (management == null)
                return;
            try {
                final Management.LogicalRecord[] results = management.getLogicalRecordArray(getVolumeName(),
                        getTreeName(), null, _logicalRecord.getKeyState(), Key.EQ, 1, Integer.MAX_VALUE, true

                );
                if (results == null || results.length == 0) {
                    _logicalRecord = null;
View Full Code Here

            if (_refreshing)
                return;
            _refreshing = true;
        }
        try {
            final Management management = _adminUI.getManagement();
            if (reset) {
                _selectedVolumeName = null;
            }

            VolumeInfo[] volumeInfoArray = null;
            if (management != null) {
                volumeInfoArray = management.getVolumeInfoArray();
            }
            _volumeInfoArrayModel.setInfoArray(volumeInfoArray);

            TreeInfo[] treeInfoArray = null;
            if (management != null && _selectedVolumeName != null) {
                treeInfoArray = management.getTreeInfoArray(_selectedVolumeName);
            }
            updateTreeListModel(_selectedVolumeName, treeInfoArray);
        } catch (final RemoteException re) {
            _adminUI.postException(re);
        } finally {
View Full Code Here

        } else if ("ADD_ALL_ALL".equals(name)) {
            _volumeList.clearSelection();
            _treeListModel.clear();
            _selectedTreeListModel.clear();
            final int volumeCount = _volumeList.getModel().getSize();
            final Management management = _adminUI.getManagement();
            if (management != null) {
                for (int volumeIndex = 0; volumeIndex < volumeCount; volumeIndex++) {
                    final VolumeInfo volumeInfo = (VolumeInfo) _volumeList.getModel().getElementAt(volumeIndex);
                    final String volumeName = volumeInfo.getName();
                    try {
                        final TreeInfo[] treeInfoArray = management.getTreeInfoArray(volumeName);

                        for (int treeIndex = 0; treeIndex < treeInfoArray.length; treeIndex++) {
                            final TreeItem item = new TreeItem();
                            item._volumeName = volumeName;
                            item._treeName = treeInfoArray[treeIndex].getName();
View Full Code Here

    }

    @Override
    protected void refresh(final boolean reset) {
        try {
            final Management management = _adminUI.getManagement();
            if (management == null) {
                _version.setText("");
                _copyright.setText("");
                _started.setText("");
                _elapsed.setText("");

                _totalReads.setText("");
                _totalWrites.setText("");
                _totalGets.setText("");
                _hitRatio.setText("");

                _commits.setText("");
                _rollbacks.setText("");
                _rollbacksSinceLastCommit.setText("");

                _journalCurLocation.setText("");
                _journalBlockSize.setText("");

                _journalBaseAddress.setText("");
                _journalPageMapSize.setText("");
                _journalPageCount.setText("");
                _journalCopiedPageCount.setText("");
                _journalReadPageCount.setText("");

                _journalValidCkptTime.setText("");
                _journalValidCkptAgo.setText("");
                _journalValidCkptTimestamp.setText("");
                _journalValidCkptLocation.setText("");

                _journalAppendOnly.setText("");
                _journalCopyFast.setText("");

                _recoveryApplied.setText("");
                _recoveryBaseAddress.setText("");
                _recoveryCkptLocation.setText("");
                _recoveryCkptTime.setText("");
                _recoveryCkptTimestamp.setText("");
                _recoveryCommitted.setText("");
                _recoveryEndAddress.setText("");
                _recoveryException.setText("");
                _recoveryKeystone.setText("");
                _recoveryUncommitted.setText("");

                _volumeInfoArrayModel.setInfoArray(null);

            } else {
                _version.setText(management.getVersion());
                _copyright.setText(management.getCopyright());

                _started.setText(_adminUI.formatDate(management.getStartTime()));

                _elapsed.setText(_adminUI.formatTime(management.getElapsedTime()));

                _frozenUpdates.setText(management.isUpdateSuspended() ? _frozenTrueCaption : _frozenFalseCaption);

                _frozenUpdates.setForeground(management.isUpdateSuspended() ? Color.red : _normalForegroundColor);

                _frozenShutdown.setText(management.isShutdownSuspended() ? _frozenTrueCaption : _frozenFalseCaption);

                _frozenShutdown.setForeground(management.isShutdownSuspended() ? Color.red : _normalForegroundColor);

                final Management.JournalInfo jinfo = management.getJournalInfo();
                _journalCurLocation.setText(_adminUI.formatFileLocation(jinfo.getCurrentJournalFile(),
                        jinfo.getCurrentJournalAddress()));
                _journalBlockSize.setText(_adminUI.formatLong(jinfo.getBlockSize()));

                _journalBaseAddress.setText(_adminUI.formatLong(jinfo.getBaseAddress()));

                _journalPageMapSize.setText(_adminUI.formatLong(jinfo.getPageMapSize()));
                _journalPageCount.setText(_adminUI.formatLong(jinfo.getJournaledPageCount()));
                _journalCopiedPageCount.setText(_adminUI.formatLong(jinfo.getCopiedPageCount()));
                _journalReadPageCount.setText(_adminUI.formatLong(jinfo.getReadPageCount()));

                if (jinfo.getLastValidCheckpointSystemTime() != 0) {
                    _journalValidCkptTime.setText(_adminUI.formatDate(jinfo.getLastValidCheckpointSystemTime()));
                    _journalValidCkptAgo.setText(_adminUI.formatLong(jinfo.getLastValidCheckpointAge()));
                    _journalValidCkptTimestamp.setText(_adminUI.formatLong(jinfo.getLastValidCheckpointTimestamp()));
                    _journalValidCkptLocation.setText(_adminUI.formatFileLocation(
                            jinfo.getLastValidCheckpointJournalFile(), jinfo.getLastValidCheckpointJournalAddress()));
                }

                _journalAppendOnly.setText(jinfo.isAppendOnly() ? _enabledCaption : _disabledCaption);

                _journalCopyFast.setText(jinfo.isFastCopying() ? _enabledCaption : _disabledCaption);

                final Management.RecoveryInfo rinfo = management.getRecoveryInfo();

                _recoveryApplied.setText(_adminUI.formatInteger(rinfo.getAppliedTransactions()));
                _recoveryBaseAddress.setText(_adminUI.formatLong(rinfo.getBaseAddress()));
                _recoveryCkptLocation.setText(_adminUI.formatLong(rinfo.getLastValidCheckpointJournalAddress()));
                _recoveryCkptTime.setText(_adminUI.formatDate(rinfo.getLastValidCheckpointSystemTime()));
                _recoveryCkptTimestamp.setText(_adminUI.formatLong(rinfo.getLastValidCheckpointTimestamp()));
                _recoveryCommitted.setText(_adminUI.formatInteger(rinfo.getCommittedTransactions()));
                _recoveryEndAddress.setText(_adminUI.formatLong(rinfo.getRecoveryEndAddress()));
                _recoveryException.setText(rinfo.getRecoveryEndedException() == null ? "none" : rinfo
                        .getRecoveryEndedException());
                _recoveryKeystone.setText(_adminUI.formatFileLocation(rinfo.getKeystoneJournalFile(),
                        rinfo.getKeystoneJournalAddress()));
                _recoveryUncommitted.setText(_adminUI.formatInteger(rinfo.getUncommittedTransactions()));

                final Management.BufferPoolInfo[] bpia = management.getBufferPoolInfoArray();

                long reads = 0;
                long writes = 0;
                long misses = 0;
                long hits = 0;
                long creates = 0;

                for (int index = 0; index < bpia.length; index++) {
                    misses += bpia[index].getMissCount();
                    hits += bpia[index].getHitCount();
                    creates += bpia[index].getNewCount();
                }

                final Management.VolumeInfo[] via = management.getVolumeInfoArray();

                if (_selectedVolumeName == null && via.length > 0) {
                    _selectedVolumeName = via[0].getName();
                }

                for (int index = 0; index < via.length; index++) {
                    reads += via[index].getReadCounter();
                    writes += via[index].getWriteCounter();
                }

                _totalReads.setText(_adminUI.formatLong(reads));
                _totalWrites.setText(_adminUI.formatLong(writes));
                _totalGets.setText(_adminUI.formatLong(misses));
                _hitRatio.setText(misses + hits + creates > 0 ? _adminUI.formatPercent((double) hits
                        / (double) (misses + hits + creates)) : "n/a");
                _volumeInfoArrayModel.setInfoArray(via);

                final Management.TransactionInfo transactionInfo = management.getTransactionInfo();
                _commits.setText(_adminUI.formatLong(transactionInfo.getCommitCount()));
                _rollbacks.setText(_adminUI.formatLong(transactionInfo.getRollbackCount()));
                _rollbacksSinceLastCommit.setText(_adminUI.formatLong(transactionInfo.getRollbackSinceCommitCount()));

            }
View Full Code Here

        add(splitPane, BorderLayout.CENTER);
    }

    @Override
    protected void refreshed() {
        final Management management = _adminUI.getManagement();
        final Management.LogicalRecord lr = _host.getLogicalRecord();
        if (management == null || lr == null) {
            nullMessage();
        } else if (_host.isShowValue()) {
            final ValueState valueState = lr.getValueState();
            try {
                final Object[] results = management.decodeValueObjects(valueState, null);
                final ValueInspectorTreeNode root = new ValueInspectorTreeNode(null, results, "Value", Object[].class);
                _treeModel.setRoot(root);
                _textArea.setText(null);

            } catch (final Exception e) {
                _host.setLogicalRecord(null);
                _adminUI.postException(e);
            }
        } else {
            final KeyState keyState = lr.getKeyState();
            try {
                final Object[] results = management.decodeKeyObjects(keyState, null);

                final ValueInspectorTreeNode root = new ValueInspectorTreeNode(null, results, "KeySegments",
                        Object[].class);
                _treeModel.setRoot(root);
            } catch (final Exception e) {
View Full Code Here

TOP

Related Classes of com.persistit.Management

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.