-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Heemin Kim <[email protected]>
- Loading branch information
Showing
6 changed files
with
74 additions
and
23 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/main/java/org/opensearch/geospatial/exceptions/ConcurrentModificationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.geospatial.exceptions; | ||
|
||
import java.io.IOException; | ||
|
||
import org.opensearch.OpenSearchException; | ||
import org.opensearch.common.io.stream.StreamInput; | ||
import org.opensearch.rest.RestStatus; | ||
|
||
/** | ||
* General ConcurrentModificationException corresponding to the {@link RestStatus#BAD_REQUEST} status code | ||
* | ||
* The exception is thrown when multiple mutation API is called for a same resource at the same time | ||
*/ | ||
public class ConcurrentModificationException extends OpenSearchException { | ||
|
||
public ConcurrentModificationException(String msg, Object... args) { | ||
super(msg, args); | ||
} | ||
|
||
public ConcurrentModificationException(String msg, Throwable cause, Object... args) { | ||
super(msg, cause, args); | ||
} | ||
|
||
public ConcurrentModificationException(StreamInput in) throws IOException { | ||
super(in); | ||
} | ||
|
||
@Override | ||
public final RestStatus status() { | ||
return RestStatus.BAD_REQUEST; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
src/test/java/org/opensearch/geospatial/exceptions/ConcurrentModificationExceptionTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.geospatial.exceptions; | ||
|
||
import org.opensearch.rest.RestStatus; | ||
import org.opensearch.test.OpenSearchTestCase; | ||
|
||
public class ConcurrentModificationExceptionTests extends OpenSearchTestCase { | ||
public void testStatusCode() { | ||
ConcurrentModificationException exception = new ConcurrentModificationException("Resource is being modified by another processor"); | ||
assertEquals(RestStatus.BAD_REQUEST, exception.status()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters