Class TransferScheduler

All Implemented Interfaces:
MBeanService, MonitorCallback, Closeable, AutoCloseable, Runnable

public final class TransferScheduler extends MBeanScheduler
The Class TransferScheduler.
  • Constructor Details

    • TransferScheduler

      public TransferScheduler(String name)
      Instantiates a new transfer scheduler.
      Parameters:
      name - the name
  • Method Details

    • notifyCompletion

      public void notifyCompletion(DataTransfer transfer)
      Notify completion.
      Parameters:
      transfer - the transfer
    • getPoolSize

      public int getPoolSize()
      Gets the pool size.
      Returns:
      the pool size
    • setPoolSize

      public void setPoolSize(int poolSize)
      Sets the pool size.
      Parameters:
      poolSize - the new pool size
    • notifyRequeue

      public void notifyRequeue(DataTransfer transfer)
      Notify requeue.
    • initialize

      public void initialize()
      Initialize.
      Overrides:
      initialize in class ECaccessScheduler
    • getDestinationThread

      public TransferScheduler.DestinationThread getDestinationThread(String destinationName) throws MasterException
      Gets the destination thread.
      Parameters:
      destinationName - the destination name
      Returns:
      the destination thread
      Throws:
      MasterException - the master exception
    • getDestinations

      public Destination[] getDestinations()
      Gets the destinations.
      Returns:
      the destinations
    • getDestinationLastTransfer

      public DataTransfer getDestinationLastTransfer(String destinationName, boolean ok)
      Gets the destination last transfer.
      Parameters:
      destinationName - the destination name
      ok - the ok
      Returns:
      the destination last transfer
    • updateHost

      public void updateHost(Host host) throws DataBaseException
      Update host.
      Parameters:
      host - the host
      Throws:
      DataBaseException - the data base exception
    • getPendingDataTransfersCount

      public int getPendingDataTransfersCount(String destinationName)
      Gets the pending data transfers count.
      Parameters:
      destinationName - the destination name
      Returns:
      the pending data transfers count
    • holdDestination

      public void holdDestination(String userName, String destinationName, String status, boolean graceful) throws DataBaseException
      Hold destination.
      Parameters:
      userName - the user name
      destinationName - the destination name
      status - the status
      graceful - the graceful
      Throws:
      DataBaseException - the data base exception
    • holdAllDestinations

      public void holdAllDestinations(String userName, String status, boolean graceful) throws DataBaseException
      Hold all destinations.
      Parameters:
      userName - the user name
      status - the status
      graceful - the graceful
      Throws:
      DataBaseException - the data base exception
    • getDestinationStatus

      public String getDestinationStatus(String destinationName) throws DataBaseException
      Gets the destination status.
      Parameters:
      destinationName - the destination name
      Returns:
      the destination status
      Throws:
      DataBaseException - the data base exception
    • getDestinationStatus

      public String getDestinationStatus(String destinationName, String statusCode) throws DataBaseException
      Gets the destination status.
      Parameters:
      destinationName - the destination name
      statusCode - the Status Code
      Returns:
      the destination status
      Throws:
      DataBaseException - the data base exception
    • restartDestination

      public void restartDestination(String userName, String comment, String destinationName, boolean graceful, boolean reset) throws DataBaseException
      Restart destination.
      Parameters:
      userName - the user name
      comment - the comment
      destinationName - the destination name
      graceful - the graceful
      reset - the reset
      Throws:
      DataBaseException - the data base exception
    • restartAllDestinations

      public void restartAllDestinations(String userName, boolean graceful) throws DataBaseException
      Restart all destinations.
      Parameters:
      userName - the user name
      graceful - the graceful
      Throws:
      DataBaseException - the data base exception
    • getMonitoringThread

      public TransferScheduler.MonitoringThread getMonitoringThread() throws MasterException
      Gets the monitoring thread.
      Returns:
      the monitoring thread
      Throws:
      MasterException - the master exception
    • nextStep

      public int nextStep()
      Next step.
      Specified by:
      nextStep in class ECaccessScheduler
      Returns:
      the int
    • getActivity

      public String getActivity()
      Gets the activity.
      Overrides:
      getActivity in class ECaccessScheduler
      Returns:
      the activity
    • getTransferServerUsedForRetrieval

      public static String getTransferServerUsedForRetrieval(DataTransfer transfer)
      Get the name of the TransferServer which was used to retrieve the file from the source host.
      Parameters:
      transfer - the transfer
      Returns:
      the transfer server used for retrieval
    • getTransferServerName

      public static TransferServer getTransferServerName(boolean debug, String transferGroupName, TransferServer originalMover, String moverList) throws IOException
      Randomly select a DataMover from a list in the format ({operator} TransferGroup) mover1,mover2 ... (e.g. (== internet) ecpds-dm1,ecpds-dm2). If there is no DataMover found then return the original DataMover.
      Parameters:
      debug - the debug
      transferGroupName - the transfer group name
      originalMover - the original mover
      moverList - the mover list
      Returns:
      the transfer server name
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • put

      public static ProxySocket put(TransferServer server, Host host, String target, long remotePosn, long size) throws MasterException
      Puts the.
      Parameters:
      server - the server
      host - the host
      target - the target
      remotePosn - the remote posn
      size - the size
      Returns:
      the proxy socket
      Throws:
      MasterException - the master exception
    • get

      public static ProxySocket get(TransferServer server, Host host, String source, long remotePosn, long length, boolean removeOriginal) throws MasterException
      Gets the.
      Parameters:
      server - the server
      host - the host
      source - the source
      remotePosn - the remote posn
      length - the length
      removeOriginal - the remove original
      Returns:
      the proxy socket
      Throws:
      MasterException - the master exception
    • get

      public static ProxySocket get(DataTransfer transfer, long remotePosn, long length) throws DataBaseException, MasterException, TransferServerProvider.TransferServerException
      Gets a ProxySocket to download a DataTransfer.
      Parameters:
      transfer - the transfer
      remotePosn - the remote posn
      length - the length
      Returns:
      the proxy socket
      Throws:
      DataBaseException - the data base exception
      MasterException - the master exception
      TransferServerProvider.TransferServerException
    • check

      public static void check(ProxySocket proxySocket) throws IOException
      Check.
      Parameters:
      proxySocket - the proxy socket
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • size

      public static long size(TransferServer server, Host host, String source) throws MasterException
      Size.
      Parameters:
      server - the server
      host - the host
      source - the source
      Returns:
      the long
      Throws:
      MasterException - the master exception
    • list

      public static String[] list(TransferServer server, Host host, String source, String pattern) throws MasterException
      List.
      Parameters:
      server - the server
      host - the host
      source - the source
      pattern - the pattern
      Returns:
      the string[]
      Throws:
      MasterException - the master exception
    • del

      public static void del(TransferServer server, Host host, String source) throws MasterException
      Del.
      Parameters:
      server - the server
      host - the host
      source - the source
      Throws:
      MasterException - the master exception
    • check

      public static void check(TransferServer server, long ticket) throws MasterException
      Check.
      Parameters:
      server - the server
      ticket - the ticket
      Throws:
      MasterException - the master exception
    • mkdir

      public static void mkdir(TransferServer server, Host host, String dir) throws MasterException
      Mkdir.
      Parameters:
      server - the server
      host - the host
      dir - the dir
      Throws:
      MasterException - the master exception
    • rmdir

      public static void rmdir(TransferServer server, Host host, String dir) throws MasterException
      Rmdir.
      Parameters:
      server - the server
      host - the host
      dir - the dir
      Throws:
      MasterException - the master exception
    • isAcquisition

      public static boolean isAcquisition(DataTransfer transfer)
      Checks if is acquisition.
      Parameters:
      transfer - the transfer
      Returns:
      true, if is acquisition
    • move

      public static void move(TransferServer server, Host host, String source, String target) throws MasterException
      Move.
      Parameters:
      server - the server
      host - the host
      source - the source
      target - the target
      Throws:
      MasterException - the master exception
    • put

      public static boolean put(TransferServer[] servers, DataTransfer transfer, Host hostForSource)
      Puts the.
      Parameters:
      servers - the servers
      transfer - the transfer
      hostForSource - the host for source
      Returns:
      true, if successful
    • filter

      public static TransferScheduler.FilterResult filter(TransferServer[] serversList, DataFile dataFile, boolean remove)
      Filter.
      Parameters:
      serversList - the servers list
      dataFile - the data file
      remove - the remove
      Returns:
      the filter result
    • replicate

      public static TransferScheduler.ReplicateResult replicate(String sourceMoverName, TransferServer[] serversList, DataTransfer transfer)
      Replicate.
      Parameters:
      serversList - the servers list
      transfer - the transfer
      Returns:
      the replicate result
    • backup

      public static TransferScheduler.BackupResult backup(Host hostForBackup, TransferServer[] servers, DataTransfer transfer) throws DataBaseException
      Backup.
      Parameters:
      hostForBackup - the host for backup
      servers - the servers
      transfer - the transfer
      Returns:
      the backup result
      Throws:
      DataBaseException - the data base exception
    • acquisition

      public static TransferScheduler.AcquisitionResult acquisition(StatusUpdate out, String destinationName, Host host, String source, String pattern, boolean synchronous) throws TransferServerProvider.TransferServerException, DataBaseException, IOException
      Version 1 is getting the list as an array of String and version 2 is getting the list as an InputStream.
      Parameters:
      out - the out
      destinationName - the destination name
      host - the host
      source - the source
      pattern - the pattern
      synchronous - the synchronous
      Returns:
      the acquisition result
      Throws:
      TransferServerProvider.TransferServerException - the transfer server exception
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • execution

      Executing script against data mover (this is because the script might open a connection to a remote site to get the list of files to retrieve).
      Parameters:
      out - the out
      destinationName - the destination name
      host - the host
      script - the script
      Returns:
      the execution result
      Throws:
      TransferServerProvider.TransferServerException - the transfer server exception
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • getNumberOfDownloadsFor

      public static int getNumberOfDownloadsFor(TransferServer server, int fileSystem)
      Allow getting the current number of downloads for the provided moverName and fileSystem.
      Parameters:
      server - the server
      fileSystem - the file system
      Returns:
      the number of downloads for
    • registerMoverMetrics

      public static void registerMoverMetrics(String groupName, String serverName, int volumeCount)
      Pre-registers a data mover in the metrics map so it appears in the download activity view immediately on connect, even before its first download. If an entry for this mover already exists, it is left untouched.
      Parameters:
      groupName - the transfer group name
      serverName - the transfer server (data mover) name
      volumeCount - the number of volumes (filesystems) on this mover
    • getDownloadMetricsSnapshot

      public static Map<String,int[]> getDownloadMetricsSnapshot()
      Returns a snapshot of the current in-flight download counts for all data movers and volumes.

      The returned map is keyed by "groupName.moverName" (e.g. "group-04.bodh1ecpdmv-04"). The value is an int[] where index i is the current download count on volume i. The array is sized to maxVolumeIndex + 1 for that mover; missing volume indices default to 0.

      The snapshot is safe for RMI serialisation — it is a deep copy of the live concurrent map.

      Returns:
      a sorted snapshot of download counts; never null; may be empty if no transfers have started yet
    • download

      public static TransferScheduler.DownloadResult download(DataTransfer transfer, Host hostForSource, List<DataTransfer> relatedTransfers) throws TransferServerProvider.TransferServerException, DataBaseException
      Download.
      Parameters:
      transfer - the transfer
      hostForSource - the host for source
      relatedTransfers - the related transfers
      Returns:
      the download result
      Throws:
      TransferServerProvider.TransferServerException - the transfer server exception
      DataBaseException - the data base exception
    • purge

      public static TransferScheduler.PurgeResult purge(TransferServer[] transfers, DataFile dataFile)
      Purge.
      Parameters:
      transfers - the transfers
      dataFile - the data file
      Returns:
      the purge result
    • purge

      public static TransferScheduler.PurgeResult purge(TransferServer[] transfers, Host proxyHost, DataFile dataFile)
      Purge.
      Parameters:
      transfers - the transfers
      proxyHost - the proxy host
      dataFile - the data file
      Returns:
      the purge result
    • purge

      public static void purge(TransferServer[] servers, Host proxyHost, List<ExistingStorageDirectory> directories)
      Purge.
      Parameters:
      servers - the servers
      proxyHost - the proxy host
      directories - the directories
    • getMoverReport

      public static String getMoverReport(Host proxyHost) throws DataBaseException, IOException
      Gets the mover report.
      Parameters:
      proxyHost - the proxy host
      Returns:
      the mover report
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • getHostReport

      public static String getHostReport(Host proxyHost, Host host) throws DataBaseException, IOException
      Gets the host report.
      Parameters:
      proxyHost - the proxy host
      host - the host
      Returns:
      the host report
      Throws:
      DataBaseException - the data base exception
      IOException - Signals that an I/O exception has occurred.
    • shutdown

      public void shutdown()
      Shutdown.
      Overrides:
      shutdown in class MBeanScheduler
    • shutdown

      public void shutdown(boolean graceful)
      Shutdown.
      Parameters:
      graceful - the graceful
    • getMBeanInfo

      public MBeanInfo getMBeanInfo()
      Gets the MBean info.
      Specified by:
      getMBeanInfo in interface MBeanService
      Overrides:
      getMBeanInfo in class MBeanScheduler
      Returns:
      the MBean info
    • getAttribute

      public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException
      Gets the attribute.
      Specified by:
      getAttribute in interface MBeanService
      Overrides:
      getAttribute in class MBeanScheduler
      Parameters:
      attributeName - the attribute name
      Returns:
      the attribute
      Throws:
      AttributeNotFoundException - the attribute not found exception
      MBeanException - the MBean exception
    • setAttribute

      public boolean setAttribute(String name, Object value) throws InvalidAttributeValueException, MBeanException
      Sets the attribute.
      Specified by:
      setAttribute in interface MBeanService
      Overrides:
      setAttribute in class MBeanScheduler
      Parameters:
      name - the name
      value - the value
      Returns:
      true, if successful
      Throws:
      InvalidAttributeValueException - the invalid attribute value exception
      MBeanException - the MBean exception