From ecc53b1bc8eeec40641d0928f1050e530f08d0d2 Mon Sep 17 00:00:00 2001 From: Florian Schmaus Date: Mon, 26 Feb 2018 10:24:01 +0100 Subject: [PATCH] Add Manager.schedule(Runnable, long, TimeUnit) using Smack's scheduled executor service. --- .../src/main/java/org/jivesoftware/smack/Manager.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/smack-core/src/main/java/org/jivesoftware/smack/Manager.java b/smack-core/src/main/java/org/jivesoftware/smack/Manager.java index 0b7924eb3..aee4bcbde 100644 --- a/smack-core/src/main/java/org/jivesoftware/smack/Manager.java +++ b/smack-core/src/main/java/org/jivesoftware/smack/Manager.java @@ -1,6 +1,6 @@ /** * - * Copyright 2014 Florian Schmaus + * Copyright 2014-2018 Florian Schmaus * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,8 @@ package org.jivesoftware.smack; import java.lang.ref.WeakReference; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; import org.jivesoftware.smack.SmackException.NotLoggedInException; import org.jivesoftware.smack.util.Objects; @@ -48,4 +50,8 @@ public abstract class Manager { } return connection; } + + protected static final ScheduledFuture schedule(Runnable runnable, long delay, TimeUnit unit) { + return AbstractXMPPConnection.SCHEDULED_EXECUTOR_SERVICE.schedule(runnable, delay, unit); + } }