Skip to content

Commit

Permalink
Merge branch '6.x.x' into ref/remove-attachment-contenttype
Browse files Browse the repository at this point in the history
  • Loading branch information
marandaneto authored Jan 18, 2022
2 parents 7f7f743 + ad9f9dc commit d6df47b
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 11 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* Feat: Relax TransactionNameProvider (#1861)
* Ref: Simplify DateUtils with ISO8601Utils (#1837)
* Ref: Remove Attachment ContentType since the Server infers it (#1874)
* Ref: Add shutdownTimeoutMillis in favor of shutdownTimeout (#1873)

## 6.0.0-alpha.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static void main(String[] args) throws InterruptedException {

// Configure the background worker which sends events to sentry:
// Wait up to 5 seconds before shutdown while there are events to send.
options.setShutdownTimeout(5000);
options.setShutdownTimeoutMillis(5000);

// Enable SDK logging with Debug level
options.setDebug(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletExcepti

// Configure the background worker which sends events to sentry:
// Wait up to 5 seconds before shutdown while there are events to send.
options.setShutdownTimeout(5000);
options.setShutdownTimeoutMillis(5000);

// Enable SDK logging with Debug level
options.setDebug(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ class SentryAutoConfigurationTest {
).run {
val options = it.getBean(SentryProperties::class.java)
assertThat(options.readTimeoutMillis).isEqualTo(10)
assertThat(options.shutdownTimeout).isEqualTo(20)
assertThat(options.shutdownTimeoutMillis).isEqualTo(20)
assertThat(options.flushTimeoutMillis).isEqualTo(30)
assertThat(options.isDebug).isTrue()
assertThat(options.diagnosticLevel).isEqualTo(SentryLevel.INFO)
Expand Down
2 changes: 2 additions & 0 deletions sentry/api/sentry.api
Original file line number Diff line number Diff line change
Expand Up @@ -1042,6 +1042,7 @@ public class io/sentry/SentryOptions {
public fun getServerName ()Ljava/lang/String;
public fun getSessionTrackingIntervalMillis ()J
public fun getShutdownTimeout ()J
public fun getShutdownTimeoutMillis ()J
public fun getSslSocketFactory ()Ljavax/net/ssl/SSLSocketFactory;
public fun getTags ()Ljava/util/Map;
public fun getTracesSampleRate ()Ljava/lang/Double;
Expand Down Expand Up @@ -1110,6 +1111,7 @@ public class io/sentry/SentryOptions {
public fun setServerName (Ljava/lang/String;)V
public fun setSessionTrackingIntervalMillis (J)V
public fun setShutdownTimeout (J)V
public fun setShutdownTimeoutMillis (J)V
public fun setSslSocketFactory (Ljavax/net/ssl/SSLSocketFactory;)V
public fun setTag (Ljava/lang/String;Ljava/lang/String;)V
public fun setTraceSampling (Z)V
Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/Hub.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ public void close() {
((Closeable) integration).close();
}
}
options.getExecutorService().close(options.getShutdownTimeout());
options.getExecutorService().close(options.getShutdownTimeoutMillis());

// Close the top-most client
final StackItem item = stack.peek();
Expand Down
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/SentryClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ public void close() {
options.getLogger().log(SentryLevel.INFO, "Closing SentryClient.");

try {
flush(options.getShutdownTimeout());
flush(options.getShutdownTimeoutMillis());
transport.close();
} catch (IOException e) {
options
Expand Down
34 changes: 28 additions & 6 deletions sentry/src/main/java/io/sentry/SentryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class SentryOptions {
* background queue and this queue is given a certain amount to drain pending events Default is
* 2000 = 2s
*/
private long shutdownTimeout = 2000; // 2s
private long shutdownTimeoutMillis = 2000; // 2s

/**
* Controls how many seconds to wait before flushing down. Sentry SDKs cache events from a
Expand Down Expand Up @@ -213,9 +213,7 @@ public class SentryOptions {
/** Automatically resolve server name. */
private boolean attachServerName = true;

/*
When enabled, Sentry installs UncaughtExceptionHandlerIntegration.
*/
/** When enabled, Sentry installs UncaughtExceptionHandlerIntegration. */
private boolean enableUncaughtExceptionHandler = true;

/** Sentry Executor Service that sends cached events and envelopes on App. start. */
Expand Down Expand Up @@ -464,19 +462,43 @@ public void setEnableNdk(boolean enableNdk) {
/**
* Returns the shutdown timeout in Millis
*
* @deprecated use {{@link SentryOptions#getShutdownTimeoutMillis()} }
* @return the timeout in Millis
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public long getShutdownTimeout() {
return shutdownTimeout;
return shutdownTimeoutMillis;
}

/**
* Returns the shutdown timeout in Millis
*
* @return the timeout in Millis
*/
public long getShutdownTimeoutMillis() {
return shutdownTimeoutMillis;
}

/**
* Sets the shutdown timeout in Millis Default is 2000 = 2s
*
* @deprecated use {{@link SentryOptions#setShutdownTimeoutMillis(long)} }
* @param shutdownTimeoutMillis the shutdown timeout in millis
*/
@ApiStatus.ScheduledForRemoval
@Deprecated
public void setShutdownTimeout(long shutdownTimeoutMillis) {
this.shutdownTimeout = shutdownTimeoutMillis;
this.shutdownTimeoutMillis = shutdownTimeoutMillis;
}

/**
* Sets the shutdown timeout in Millis Default is 2000 = 2s
*
* @param shutdownTimeoutMillis the shutdown timeout in millis
*/
public void setShutdownTimeoutMillis(long shutdownTimeoutMillis) {
this.shutdownTimeoutMillis = shutdownTimeoutMillis;
}

/**
Expand Down

0 comments on commit d6df47b

Please sign in to comment.