001/*
002 * JPPF.
003 * Copyright (C) 2005-2019 JPPF Team.
004 * http://www.jppf.org
005 *
006 * Licensed under the Apache License, Version 2.0 (the "License");
007 * you may not use this file except in compliance with the License.
008 * You may obtain a copy of the License at
009 *
010 *   http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018package org.jppf.node;
019
020import org.jppf.management.*;
021import org.jppf.utils.TypedProperties;
022
023/**
024 * Interface for a node that provides information about its activity.
025 * @author Laurent Cohen
026 */
027public interface Node extends Runnable {
028  /**
029   * Get this node's UUID.
030   * @return the uuid as a string.
031   */
032  String getUuid();
033
034  /**
035   * Get the system information for this node.
036   * @return a {@link JPPFSystemInformation} instance.
037   */
038  JPPFSystemInformation getSystemInformation();
039
040  /**
041   * Determine whether this node is local to another component.
042   * @return {@code true} if this node is local, {@code false} otherwise.
043   */
044  boolean isLocal();
045
046  /**
047   * Reset the current task class loader if any is present (i.e. if a job is being executed), without reconnecting to the server.
048   * @param params a (possibly empty) set of arbitrary parameters to propagate to the class loader.
049   * @return the newly created class loader, or {@code null} if none could be created at this time.
050   * This class loader can be safely cast to an {@link org.jppf.classloader.AbstractJPPFClassLoader AbstractJPPFClassLoader}.
051   */
052  ClassLoader resetTaskClassLoader(final Object...params);
053
054  /**
055   * Determine whether this node is running in offline mode.
056   * @return {@code true} if this node is offline, {@code false} otherwise.
057   */
058  boolean isOffline();
059
060  /**
061   * Determine whether this node is a 'master' node for the provisioning features.
062   * @return {@code true} if this node is a master, {@code false} otherwise.
063   */
064  boolean isMasterNode();
065
066  /**
067   * Determine whether this node is a 'slave' node for the provisioning features.
068   * @return {@code true} if this node is a slave, {@code false} otherwise.
069   */
070  boolean isSlaveNode();
071
072  /**
073   * Get the uuid of the node who this node is a slave of.
074   * @return the uuid of this node's master node, or {@code null} if this node is not a slave.
075   * @since 6.0
076   */
077  public String getMasterNodeUuid();
078
079  /**
080   * Determine whether this node can execute .Net tasks.
081   * @return {@code true} if this node can execute .Net tasks, {@code false} otherwise.
082   */
083  boolean isDotnetCapable();
084
085  /**
086   * Determine whether this node is an Android node.
087   * @return {@code true} if this node runs on Android, {@code false} otherwise.
088   */
089  boolean isAndroid();
090
091  /**
092   * Get the configuration of this node.
093   * @return the node configuration as a {@link TypedProperties} instance.
094   */
095  TypedProperties getConfiguration();
096
097  /**
098   * Get the management information for this node.
099   * @return a {@link JPPFManagementInfo} object.
100   */
101  JPPFManagementInfo getManagementInfo();
102
103  /**
104   * Get the total number of tasks executed.
105   * @return the number of tasks as an int.
106   */
107  int getExecutedTaskCount();
108}