GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Issue #868 - Use static Throwables without backtrace/stackTrace · grgrzybek/jetty.project@d37a315

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • jetty-continuation/src/main/java/org/eclipse/jetty/continuation
    • ContinuationThrowable.java
  • jetty-util/src/main/java/org/eclipse/jetty/util
    • ConstantThrowable.java
    • FutureCallback.java
    • FuturePromise.java
    • SharedBlockingCallback.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationThrowable.java‎

Copy file name to clipboardExpand all lines: jetty-continuation/src/main/java/org/eclipse/jetty/continuation/ContinuationThrowable.java
+6-1Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@
4343
* </p>
4444
*/
4545
public class ContinuationThrowable extends Error
46-
{}
46+
{
47+
public ContinuationThrowable()
48+
{
49+
super(null, null, false, false);
50+
}
51+
}
Collapse file

‎jetty-util/src/main/java/org/eclipse/jetty/util/ConstantThrowable.java‎

Copy file name to clipboard
+43Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//
2+
// ========================================================================
3+
// Copyright (c) 1995-2016 Mort Bay Consulting Pty. Ltd.
4+
// ------------------------------------------------------------------------
5+
// All rights reserved. This program and the accompanying materials
6+
// are made available under the terms of the Eclipse Public License v1.0
7+
// and Apache License v2.0 which accompanies this distribution.
8+
//
9+
// The Eclipse Public License is available at
10+
// http://www.eclipse.org/legal/epl-v10.html
11+
//
12+
// The Apache License v2.0 is available at
13+
// http://www.opensource.org/licenses/apache2.0.php
14+
//
15+
// You may elect to redistribute this code under either of these licenses.
16+
// ========================================================================
17+
//
18+
19+
package org.eclipse.jetty.util;
20+
21+
/**
22+
* A {@link Throwable} that may be used in static contexts. It uses Java 7
23+
* constructor that prevents setting stackTrace inside exception object.
24+
*/
25+
public class ConstantThrowable extends Throwable {
26+
27+
private String name;
28+
29+
public ConstantThrowable() {
30+
this(null);
31+
}
32+
33+
public ConstantThrowable(String name) {
34+
super(null, null, false, false);
35+
this.name = name;
36+
}
37+
38+
@Override
39+
public String toString() {
40+
return name;
41+
}
42+
43+
}
Collapse file

‎jetty-util/src/main/java/org/eclipse/jetty/util/FutureCallback.java‎

Copy file name to clipboardExpand all lines: jetty-util/src/main/java/org/eclipse/jetty/util/FutureCallback.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
public class FutureCallback implements Future<Void>,Callback
3131
{
32-
private static Throwable COMPLETED=new Throwable();
32+
private static Throwable COMPLETED=new ConstantThrowable();
3333
private final AtomicBoolean _done=new AtomicBoolean(false);
3434
private final CountDownLatch _latch=new CountDownLatch(1);
3535
private Throwable _cause;
Collapse file

‎jetty-util/src/main/java/org/eclipse/jetty/util/FuturePromise.java‎

Copy file name to clipboardExpand all lines: jetty-util/src/main/java/org/eclipse/jetty/util/FuturePromise.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
public class FuturePromise<C> implements Future<C>,Promise<C>
3131
{
32-
private static Throwable COMPLETED=new Throwable();
32+
private static Throwable COMPLETED=new ConstantThrowable();
3333
private final AtomicBoolean _done=new AtomicBoolean(false);
3434
private final CountDownLatch _latch=new CountDownLatch(1);
3535
private Throwable _cause;
Collapse file

‎jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java‎

Copy file name to clipboardExpand all lines: jetty-util/src/main/java/org/eclipse/jetty/util/SharedBlockingCallback.java
+3-24Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,30 +50,9 @@
5050
public class SharedBlockingCallback
5151
{
5252
static final Logger LOG = Log.getLogger(SharedBlockingCallback.class);
53-
private static Throwable IDLE = new Throwable()
54-
{
55-
@Override
56-
public String toString()
57-
{
58-
return "IDLE";
59-
}
60-
};
61-
private static Throwable SUCCEEDED = new Throwable()
62-
{
63-
@Override
64-
public String toString()
65-
{
66-
return "SUCCEEDED";
67-
}
68-
};
69-
private static Throwable FAILED = new Throwable()
70-
{
71-
@Override
72-
public String toString()
73-
{
74-
return "FAILED";
75-
}
76-
};
53+
private static Throwable IDLE = new ConstantThrowable("IDLE");
54+
private static Throwable SUCCEEDED = new ConstantThrowable("SUCCEEDED");
55+
private static Throwable FAILED = new ConstantThrowable("FAILED");
7756

7857
private final ReentrantLock _lock = new ReentrantLock();
7958
private final Condition _idle = _lock.newCondition();

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.