1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements.  See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership.  The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License.  You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied.  See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 module hunt.shiro.concurrent.SubjectAwareScheduledExecutorService;
20 
21 // import hunt.concurrency;
22 
23 /**
24  * Same concept as the {@link SubjectAwareExecutorService} but additionally supports the
25  * {@link ScheduledExecutorService} interface.
26  */
27 // class SubjectAwareScheduledExecutorService : SubjectAwareExecutorService, ScheduledExecutorService {
28 
29 //     private ScheduledExecutorService targetScheduledExecutorService;
30 
31 //      this() {
32 //     }
33 
34 //      this(ScheduledExecutorService target) {
35 //         setTargetScheduledExecutorService(target);
36 //     }
37 
38 //      ScheduledExecutorService getTargetScheduledExecutorService() {
39 //         return targetScheduledExecutorService;
40 //     }
41 
42 //      void setTargetScheduledExecutorService(ScheduledExecutorService targetScheduledExecutorService) {
43 //         super.setTargetExecutorService(targetScheduledExecutorService);
44 //         this.targetScheduledExecutorService = targetScheduledExecutorService;
45 //     }
46 
47 //     override
48 //      void setTargetExecutor(Executor targetExecutor) {
49 //         auto targetExecutorCast = cast(ScheduledExecutorService)targetExecutor;
50 //         if (targetExecutorCast is null) {
51 //             string msg = "The SubjectAwareScheduledExecutorService implementation only accepts " ~
52 //                          "ScheduledExecutorService target instances.";
53 //             throw new IllegalArgumentException(msg);
54 //         }
55 //         super.setTargetExecutorService(targetExecutorCast);
56 //     }
57 
58 //     override
59 //      void setTargetExecutorService(ExecutorService targetExecutorService) {
60 //         auto targetExecutorServiceCast = cast(ScheduledExecutorService)targetExecutorService;
61 //         if (targetExecutorServiceCast is null) {
62 //             string msg = "The SubjectAwareScheduledExecutorService implementation only accepts " ~
63 //                          "ScheduledExecutorService target instances.";
64 //             throw new IllegalArgumentException(msg);
65 //         }
66 //         super.setTargetExecutorService(targetExecutorService);
67 //     }
68 
69 //      ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) {
70 //         Runnable work = associateWithSubject(command);
71 //         return this.targetScheduledExecutorService.schedule(work, delay, unit);
72 //     }
73 
74 //      <V> ScheduledFuture!(V) schedule(Callable!(V) callable, long delay, TimeUnit unit) {
75 //         Callable!(V) work = associateWithSubject(callable);
76 //         return this.targetScheduledExecutorService.schedule(work, delay, unit);
77 //     }
78 
79 //      ScheduledFuture<?> scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) {
80 //         Runnable work = associateWithSubject(command);
81 //         return this.targetScheduledExecutorService.scheduleAtFixedRate(work, initialDelay, period, unit);
82 //     }
83 
84 //      ScheduledFuture<?> scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) {
85 //         Runnable work = associateWithSubject(command);
86 //         return this.targetScheduledExecutorService.scheduleWithFixedDelay(work, initialDelay, delay, unit);
87 //     }
88 // }