Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
d2a78080
Commit
d2a78080
authored
Jul 23, 2020
by
Phillip Webb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Polish
parent
217b2eff
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
26 deletions
+31
-26
ElasticsearchReactiveHealthIndicator.java
...e/elasticsearch/ElasticsearchReactiveHealthIndicator.java
+25
-22
build.gradle
spring-boot-project/spring-boot-docs/build.gradle
+1
-1
LocalHttpClientTransport.java
...k/platform/docker/transport/LocalHttpClientTransport.java
+4
-2
ZipFileTarArchive.java
...amework/boot/buildpack/platform/io/ZipFileTarArchive.java
+1
-1
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/elasticsearch/ElasticsearchReactiveHealthIndicator.java
View file @
d2a78080
...
...
@@ -23,8 +23,11 @@ import reactor.core.publisher.Mono;
import
org.springframework.boot.actuate.health.AbstractReactiveHealthIndicator
;
import
org.springframework.boot.actuate.health.Health
;
import
org.springframework.boot.actuate.health.HealthIndicator
;
import
org.springframework.boot.actuate.health.Status
;
import
org.springframework.core.ParameterizedTypeReference
;
import
org.springframework.data.elasticsearch.client.reactive.ReactiveElasticsearchClient
;
import
org.springframework.web.reactive.function.client.ClientResponse
;
import
org.springframework.web.reactive.function.client.WebClient
;
/**
* {@link HealthIndicator} for an Elasticsearch cluster using a
...
...
@@ -50,28 +53,28 @@ public class ElasticsearchReactiveHealthIndicator extends AbstractReactiveHealth
@Override
protected
Mono
<
Health
>
doHealthCheck
(
Health
.
Builder
builder
)
{
return
this
.
client
.
execute
(
(
callback
)
->
callback
.
get
().
uri
(
"/_cluster/health/"
).
exchange
())
.
flatMap
((
response
)
->
{
if
(
response
.
statusCode
().
is2xxSuccessful
())
{
return
response
.
bodyToMono
(
STRING_OBJECT_MAP
).
map
((
body
)
->
{
String
status
=
(
String
)
body
.
get
(
"status"
);
if
(
RED_STATUS
.
equals
(
status
))
{
builder
.
outOfService
();
}
else
{
builder
.
up
(
);
}
builder
.
withDetails
(
body
);
return
builder
.
build
(
);
}
);
}
else
{
builder
.
down
();
builder
.
withDetail
(
"statusCode"
,
response
.
rawStatusCode
());
builder
.
withDetail
(
"reasonPhrase"
,
response
.
statusCode
().
getReasonPhrase
()
);
return
response
.
releaseBody
().
thenReturn
(
builder
.
build
()
);
}
}
);
return
this
.
client
.
execute
(
this
::
getHealth
).
flatMap
((
response
)
->
doHealthCheck
(
builder
,
response
));
}
private
Mono
<
ClientResponse
>
getHealth
(
WebClient
webClient
)
{
return
webClient
.
get
().
uri
(
"/_cluster/health/"
).
exchange
(
);
}
private
Mono
<
Health
>
doHealthCheck
(
Health
.
Builder
builder
,
ClientResponse
response
)
{
if
(
response
.
statusCode
().
is2xxSuccessful
())
{
return
response
.
bodyToMono
(
STRING_OBJECT_MAP
).
map
((
body
)
->
getHealth
(
builder
,
body
)
);
}
builder
.
down
(
);
builder
.
withDetail
(
"statusCode"
,
response
.
rawStatusCode
()
);
builder
.
withDetail
(
"reasonPhrase"
,
response
.
statusCode
().
getReasonPhrase
()
);
return
response
.
releaseBody
().
thenReturn
(
builder
.
build
());
}
private
Health
getHealth
(
Health
.
Builder
builder
,
Map
<
String
,
Object
>
body
)
{
String
status
=
(
String
)
body
.
get
(
"status"
);
builder
.
status
(
RED_STATUS
.
equals
(
status
)
?
Status
.
OUT_OF_SERVICE
:
Status
.
UP
);
builder
.
withDetails
(
body
);
return
builder
.
build
(
);
}
}
spring-boot-project/spring-boot-docs/build.gradle
View file @
d2a78080
...
...
@@ -95,7 +95,7 @@ dependencies {
testImplementation
(
project
(
":spring-boot-project:spring-boot-tools:spring-boot-test-support"
))
testImplementation
(
"org.assertj:assertj-core"
)
testImplementation
(
"org.junit.jupiter:junit-jupiter"
)
testRuntimeOnly
(
project
(
":spring-boot-project:spring-boot-starters:spring-boot-starter-web"
))
testRuntimeOnly
(
"com.h2database:h2"
)
testRuntimeOnly
(
"org.springframework:spring-jdbc"
)
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/LocalHttpClientTransport.java
View file @
d2a78080
...
...
@@ -69,8 +69,10 @@ final class LocalHttpClientTransport extends HttpClientTransport {
private
static
String
socketFilePath
(
Environment
environment
)
{
String
host
=
environment
.
get
(
DOCKER_HOST
);
return
(
host
!=
null
&&
host
.
startsWith
(
UNIX_SOCKET_PREFIX
))
?
host
.
substring
(
UNIX_SOCKET_PREFIX
.
length
())
:
host
;
if
(
host
!=
null
&&
host
.
startsWith
(
UNIX_SOCKET_PREFIX
))
{
return
host
.
substring
(
UNIX_SOCKET_PREFIX
.
length
());
}
return
host
;
}
/**
...
...
spring-boot-project/spring-boot-tools/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/io/ZipFileTarArchive.java
View file @
d2a78080
...
...
@@ -76,7 +76,7 @@ public class ZipFileTarArchive implements TarArchive {
private
void
assertArchiveHasEntries
(
File
jarFile
)
{
try
(
ZipFile
zipFile
=
new
ZipFile
(
jarFile
))
{
Assert
.
state
(
zipFile
.
getEntries
().
hasMoreElements
(),
"File '"
+
jarFile
.
toString
()
Assert
.
state
(
zipFile
.
getEntries
().
hasMoreElements
(),
()
->
"File '"
+
jarFile
+
"' is not compatible with buildpacks; ensure jar file is valid and launch script is not enabled"
);
}
catch
(
IOException
ex
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment