Class UdevService

java.lang.Object
com.kosdev.kos.core.service.udev.UdevService

public final class UdevService extends Object
Service that manages events from udev adapter.
Since:
1
Version:
10
  • Method Details

    • removeOwner

      public void removeOwner(UdevDeviceOwner owner)
      Release all devices claimed by the owner.
      Since:
      1
    • addGlobalMonitor

      public void addGlobalMonitor(UdevSubsystemMonitor monitor)
      Add a subsystem monitor to all nodes that attach UdevAdapters to this node. This allows the monitor to detect device add/remove events.

      In a multi-node environment, it is possible to run java on more than one node in which case each node running java will likely have udevAdapter point to itself for local node use. In this configuration, a global monitor will not detect any events from other nodes as the devices are being managed locally on that node. In the case where one node runs java and another doesn't, but the node running java wants to use devices on the other node, it is possible to run udevAdapter on the non-java node such that it connects to the java node, resulting in the java node having multiple adapters connected. In this case, a global monitor will process devices from both nodes.

      Not all subsystems make sense to be globally monitored. For example, storage devices can be detected and event mounted via udevAdapter , but as they may be on another node, java cannot access those remote filesystems directly.

      Adding a monitor may result in immediate device events. In the case the callbacks will come from the calling thread. Application logic should be designed to handle this.

      Parameters:
      monitor - the monitor to attach
      Since:
      10
    • removeGlobalMonitor

      public void removeGlobalMonitor(UdevSubsystemMonitor monitor)
      Remove a subsystem monitor from the global monitor list. This will remove the monitor from all associated nodes. This will not generate any device events. In the event that remove device events are required, remove all the matchers from the monitor before removing the monitor itself.
      Parameters:
      monitor - the monitor to remove
      Since:
      10
    • addMonitor

      public void addMonitor(UdevSubsystemMonitor monitor)
      Add a subsystem monitor to the local node. This allows the monitor to detect device add/remove events.

      Adding a monitor may result in immediate device events. In the case the callbacks will come from the calling thread. Application logic should be designed to handle this.

      Parameters:
      monitor - the monitor to attach
      Since:
      10
    • removeMonitor

      public void removeMonitor(UdevSubsystemMonitor monitor)
      Remove a subsystem monitor from the local node. This will not generate any device events. In the event that remove device events are required, remove all the matchers from the monitor before removing the monitor itself.
      Parameters:
      monitor - the monitor to remove
      Since:
      10
    • addMonitor

      public void addMonitor(NodeId nodeId, UdevSubsystemMonitor monitor)
      Add a subsystem monitor to the specified node. This allows the monitor to detect device add/remove events. This will only generate events if udevAdapter on the node is configured to connect to this node.

      Adding a monitor may result in immediate device events. In the case the callbacks will come from the calling thread. Application logic should be designed to handle this.

      Parameters:
      monitor - the monitor to attach
      Since:
      10
    • removeMonitor

      public void removeMonitor(NodeId nodeId, UdevSubsystemMonitor monitor)
      Remove a subsystem monitor from the specified node. This will not generate any device events. In the event that remove device events are required, remove all the matchers from the monitor before removing the monitor itself.
      Parameters:
      monitor - the monitor to remove
      Since:
      10