1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements.  See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License.  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 module hunt.pool.impl.CallStackUtils;
18 
19 // import java.security.AccessControlException;
20 
21 /**
22  * Utility methods for {@link CallStack}.
23  *
24  */
25 // class CallStackUtils {
26 
27 //     /**
28 //      * @return {@code true} if it is able to create a security manager in the current environment, {@code false}
29 //      *         otherwise.
30 //      */
31 //     private static bool canCreateSecurityManager() {
32 //         SecurityManager manager = System.getSecurityManager();
33 //         if (manager is null) {
34 //             return true;
35 //         }
36 //         try {
37 //             manager.checkPermission(new RuntimePermission("createSecurityManager"));
38 //             return true;
39 //         } catch (AccessControlException ignored) {
40 //             return false;
41 //         }
42 //     }
43 
44 //     /**
45 //      * Constructs a new {@link CallStack} using the fastest allowed strategy.
46 //      *
47 //      * @param messageFormat message (or format) to print first in stack traces
48 //      * @param useTimestamp  if true, interpret message as a SimpleDateFormat and print the created timestamp; otherwise,
49 //      *                      print message format literally
50 //      * @return a new CallStack
51 //      * @deprecated use {@link #newCallStack(string, bool, bool)}
52 //      */
53 //     static CallStack newCallStack(string messageFormat, bool useTimestamp) {
54 //         return newCallStack(messageFormat, useTimestamp, false);
55 //     }
56 
57 //     /**
58 //      * Constructs a new {@link CallStack} using the fasted allowed strategy.
59 //      *
60 //      * @param messageFormat         message (or format) to print first in stack traces
61 //      * @param useTimestamp          if true, interpret message as a SimpleDateFormat and print the created timestamp;
62 //      *                              otherwise, print message format literally
63 //      * @param requireFullStackTrace if true, forces the use of a stack walking mechanism that includes full stack trace
64 //      *                              information; otherwise, uses a faster implementation if possible
65 //      * @return a new CallStack
66 //      */
67 //     static CallStack newCallStack(string messageFormat,
68 //                                          bool useTimestamp,
69 //                                          bool requireFullStackTrace) {
70 //         return canCreateSecurityManager() && !requireFullStackTrace
71 //             ? new SecurityManagerCallStack(messageFormat, useTimestamp)
72 //             : new ThrowableCallStack(messageFormat, useTimestamp);
73 //     }
74 
75 //     /**
76 //      * Hidden constructor.
77 //      */
78 //     private this() {
79 //     }
80 // }