Package ball.upnp.ssdp
Class SSDPDiscoveryService
- java.lang.Object
-
- java.util.concurrent.AbstractExecutorService
-
- java.util.concurrent.ThreadPoolExecutor
-
- java.util.concurrent.ScheduledThreadPoolExecutor
-
- ball.upnp.ssdp.SSDPDiscoveryService
-
- All Implemented Interfaces:
Executor,ExecutorService,ScheduledExecutorService
public class SSDPDiscoveryService extends ScheduledThreadPoolExecutor
SSDP discoveryScheduledThreadPoolExecutorimplementation.Bean Property Summary
Name Mode Type isHidden isBound isConstrained activeCount R intfalse false false bootId R intfalse false false completedTaskCount R longfalse false false continueExistingPeriodicTasksAfterShutdownPolicy RW booleanfalse false false corePoolSize RW intfalse false false executeExistingDelayedTasksAfterShutdownPolicy RW booleanfalse false false largestPoolSize R intfalse false false maximumPoolSize RW intfalse false false nextBootId R intfalse false false poolSize R intfalse false false queue R BlockingQueue<Runnable>false false false rejectedExecutionHandler RW RejectedExecutionHandlerfalse false false removeOnCancelPolicy RW booleanfalse false false searchPort R intfalse false false shutdown R booleanfalse false false taskCount R longfalse false false terminated R booleanfalse false false terminating R booleanfalse false false threadFactory RW ThreadFactoryfalse false false userAgent R Stringfalse false false - Author:
- Allen D. Ball
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceSSDPDiscoveryService.ListenerSSDPDiscoveryServicelistener interface definition.static classSSDPDiscoveryService.RequestHandlerSSDPDiscoveryServiceSSDPRequesthandler.static classSSDPDiscoveryService.ResponseHandlerSSDPDiscoveryServiceSSDPResponsehandler.-
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
-
-
Constructor Summary
Constructors Constructor Description SSDPDiscoveryService(String product)Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SSDPDiscoveryServiceaddListener(SSDPDiscoveryService.Listener listener)Method to add aSSDPDiscoveryService.Listener.SSDPDiscoveryServiceadvertise(RootDevice device, int rate)Method to add aRootDeviceto advertise.intgetBootId()BOOTID.UPNP.ORGintgetNextBootId()NEXTBOOTID.UPNP.ORGintgetSearchPort()SEARCHPORT.UPNP.ORGStringgetUserAgent()SERVERandUSER-AGENTvoidmsearch(int mx, URI st)Send multicastM-SEARCHmesssage.voidmulticast(long delay, SSDPMessage message)Method to queue anSSDPMessagefor multicast with delay.voidmulticast(SSDPMessage message)Method to queue anSSDPMessagefor multicast without delay.SSDPDiscoveryServiceremoveListener(SSDPDiscoveryService.Listener listener)Method to remove aSSDPDiscoveryService.Listener.voidsend(int mx, SocketAddress address, List<? extends SSDPMessage> messages)voidsend(long delay, SocketAddress address, SSDPMessage message)Method to queue anSSDPMessagefor sending with delay.voidsend(SocketAddress address, SSDPMessage message)Method to queue anSSDPMessagefor sending without delay.voidshutdown()-
Methods inherited from class java.util.concurrent.ScheduledThreadPoolExecutor
decorateTask, decorateTask, execute, getContinueExistingPeriodicTasksAfterShutdownPolicy, getExecuteExistingDelayedTasksAfterShutdownPolicy, getQueue, getRemoveOnCancelPolicy, schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay, setContinueExistingPeriodicTasksAfterShutdownPolicy, setExecuteExistingDelayedTasksAfterShutdownPolicy, setRemoveOnCancelPolicy, shutdownNow, submit, submit, submit
-
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, beforeExecute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, terminated, toString
-
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated
-
-
-
-
Constructor Detail
-
SSDPDiscoveryService
public SSDPDiscoveryService(String product) throws IOException
Sole constructor.- Parameters:
product- Theproduct/versionStringidentifying this UPnP application.- Throws:
IOException- If the underlyingMulticastSocketcannot be conditioned.
-
-
Method Detail
-
getUserAgent
public String getUserAgent()
SERVERandUSER-AGENT- Returns:
SERVERandUSER-AGENT
-
getBootId
public int getBootId()
BOOTID.UPNP.ORG- Returns:
bootId
-
getNextBootId
public int getNextBootId()
NEXTBOOTID.UPNP.ORG- Returns:
nextBootId
-
getSearchPort
public int getSearchPort()
SEARCHPORT.UPNP.ORG- Returns:
- Search port.
-
addListener
public SSDPDiscoveryService addListener(SSDPDiscoveryService.Listener listener)
Method to add aSSDPDiscoveryService.Listener.- Parameters:
listener- TheSSDPDiscoveryService.Listener.- Returns:
this
-
removeListener
public SSDPDiscoveryService removeListener(SSDPDiscoveryService.Listener listener)
Method to remove aSSDPDiscoveryService.Listener.- Parameters:
listener- TheSSDPDiscoveryService.Listener.- Returns:
this
-
advertise
public SSDPDiscoveryService advertise(RootDevice device, int rate)
Method to add aRootDeviceto advertise.- Parameters:
device- TheRootDeviceto advertise.rate- The rate (in seconds) to repeat advertisements.- Returns:
this
-
msearch
public void msearch(int mx, URI st)
Send multicastM-SEARCHmesssage.- Parameters:
mx- TheMXheader value.st- TheSTheader value.
-
multicast
public void multicast(SSDPMessage message)
Method to queue anSSDPMessagefor multicast without delay.- Parameters:
message- TheSSDPMessageto send.
-
multicast
public void multicast(long delay, SSDPMessage message)
Method to queue anSSDPMessagefor multicast with delay.- Parameters:
delay- Time to delay (in milliseconds) before sending.message- TheSSDPMessageto send.
-
send
public void send(SocketAddress address, SSDPMessage message)
Method to queue anSSDPMessagefor sending without delay.- Parameters:
address- The destinationSocketAddress.message- TheSSDPMessageto send.
-
send
public void send(long delay, SocketAddress address, SSDPMessage message)
Method to queue anSSDPMessagefor sending with delay.- Parameters:
delay- Time to delay (in milliseconds) before sending.address- The destinationSocketAddress.message- TheSSDPMessageto send.
-
send
public void send(int mx, SocketAddress address, List<? extends SSDPMessage> messages)
Method to queue aListofSSDPMessages for sending with aMXparameter. Messages are sent in list order with random delays none greater thatMXseconds.- Parameters:
mx- Maximum delay (in seconds) before sending.address- The destinationSocketAddress.messages- TheListofSSDPMessages to send.
-
shutdown
public void shutdown()
- Specified by:
shutdownin interfaceExecutorService- Overrides:
shutdownin classScheduledThreadPoolExecutor
-
-