blob: d49acf0697759845d8c54f178985163fb3d961a0 [file] [log] [blame]
/*=============================================================================#
# Copyright (c) 2013, 2018 Stephan Wahlbrink and others.
#
# This program and the accompanying materials are made available under the
# terms of the Eclipse Public License 2.0 which is available at
# https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
# which is available at https://www.apache.org/licenses/LICENSE-2.0.
#
# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
#
# Contributors:
# Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
#=============================================================================*/
package org.eclipse.statet.internal.rj.servi;
import java.util.Date;
import org.eclipse.statet.jcommons.rmi.RMIAddress;
import org.eclipse.statet.rj.servi.jmx.NodeStateMX;
import org.eclipse.statet.rj.servi.pool.PoolNodeItem;
import org.eclipse.statet.rj.servi.pool.PoolNodeState;
public class MXNodeState implements NodeStateMX {
private final PoolNodeItem item;
private final Date creationTime;
private final Date stateTime;
public MXNodeState(final PoolNodeItem item) {
this.item= item;
this.creationTime= new Date(this.item.getCreationTime());
this.stateTime= new Date(this.item.getStateTime());
}
@Override
public PoolNodeState getState() {
return this.item.getState();
}
@Override
public Date getStateBeginTime() {
return this.stateTime;
}
@Override
public String getCurrentClientId() {
return this.item.getCurrentClientId();
}
@Override
public Date getCreationTime() {
return this.creationTime;
}
@Override
public long getUsageCount() {
return this.item.getUsageCount();
}
@Override
public long getUsageDuration() {
return this.item.getUsageDuration();
}
@Override
public String getRMIAddress() {
final RMIAddress address= this.item.getAddress();
return (address != null) ? address.getAddress() : "";
}
}