LOL, I thought about that too.

Actually, most of my ping service endpoints I write now (whether HTTP or
other... TCP/IP) just respond with "PONG", as you said.

I don't think that is boring at all.

On Thu, Jul 13, 2017 at 1:45 PM, Kirk Lund <kl...@apache.org> wrote:

> I'm really boring... I would've just had it reply "PONG" ;)
>
> On Thu, Jul 13, 2017 at 11:57 AM, John Blum <jb...@pivotal.io> wrote:
>
> > Here you go...
> >
> > https://github.com/apache/geode/blob/rel/v1.1.1/geode-
> > core/src/main/java/org/apache/geode/management/internal/web/shell/
> > RestHttpOperationInvoker.java#L151-L204
> >
> >
> > On Thu, Jul 13, 2017 at 10:51 AM, John Blum <jb...@pivotal.io> wrote:
> >
> > > Corrections below (apologies)...
> > >
> > > On Thu, Jul 13, 2017 at 10:44 AM, John Blum <jb...@pivotal.io> wrote:
> > >
> > >> Yeah, that was my doing. :)
> > >>
> > >> I thought it would be more fun to return a special message than the
> > >> typical "Alive".  "Mischief Managed" comes from *Harry Potter*.
> > >>
> > >> This endpoint is of course benign/idempotent and was purely meant to
> > test
> > >> the Management REST API's availability, or rather that the
> > Manage/Locator
> > >> was still "online".
> > >>
> > >> Unlike JMX RMI, HTTP is stateless.  When a JMX RMI connection is made,
> > it
> > >> is persistent and constantly "connected", where as each HTTP request
> to
> > the
> > >> Management REST API opens and closes a connection.  Therefore, you
> have
> > no
> > >> idea whether *Gfsh* is still connected to the Manager between requests
> > >> unlike the JMX RMI connection.
> > >>
> > >> So, I run a background Thread that "polls" this endpoint every 500 ms.
> > >> It might even test the message; I don't remember.  Once the response
> is
> > >> anything other than 200 OK, then we know there is a problem and that
> the
> > >> connection was most likely terminated.
> > >>
> > >> Therefore, it keeps the behavior of the HTTP connection between *Gfsh*
> > >> and the Manager similar to the JMX RMI connection by returning...
> > >>
> > >> No longer connected to 10.99.199.10[1099].
> > >>
> > >> gfsh>
> > >>
> > >>
> > >> On Thu, Jul 13, 2017 at 10:36 AM, Jacob Barrett <jbarr...@pivotal.io>
> > >> wrote:
> > >>
> > >>> For the older crowed I would have rather it replied:
> > >>>
> > >>> Ah, I see you have the machine that goes 'ping!'.
> > >>>
> > >>> Sent from my iPhone
> > >>>
> > >>> > On Jul 13, 2017, at 10:23 AM, Jared Stewart <jstew...@pivotal.io>
> > >>> wrote:
> > >>> >
> > >>> > I'm young enough to recognize it as a Harry Potter reference, but I
> > >>> have no
> > >>> > idea what it's doing in our product code.
> > >>> >
> > >>> > - Jared
> > >>> >
> > >>> >> On Jul 13, 2017 10:14 AM, "Kirk Lund" <kl...@apache.org> wrote:
> > >>> >>
> > >>> >> Anyone know why the response to a REST service PING returns
> > "Mischief
> > >>> >> Managed!?
> > >>> >>
> > >>> >> @RequestMapping(method = {RequestMethod.GET, RequestMethod.HEAD},
> > >>> value =
> > >>> >> "/ping")
> > >>> >> public ResponseEntity<String> ping() {
> > >>> >>  return new ResponseEntity<String>("<html><body><h1>Mischief
> > >>> >> Managed!</h1></body></html>",
> > >>> >>      HttpStatus.OK);
> > >>> >> }
> > >>> >>
> > >>> >> <klund@Kirks-MacBook-Pro>/Users/klund/dev/geode [949]$ git grep
> > >>> 'Mischief
> > >>> >> Managed'
> > >>> >> geode-core/src/main/java/org/apache/geode/management/
> > >>> >> internal/web/controllers/ShellCommandsController.java:
> > >>> >>   return new ResponseEntity<String>("<html><body><h1>Mischief
> > >>> >> Managed!</h1></body></html>",
> > >>> >>
> > >>>
> > >>
> > >>
> > >>
> > >> --
> > >> -John
> > >> john.blum10101 (skype)
> > >>
> > >
> > >
> > >
> > > --
> > > -John
> > > john.blum10101 (skype)
> > >
> >
> >
> >
> > --
> > -John
> > john.blum10101 (skype)
> >
>



-- 
-John
john.blum10101 (skype)

Reply via email to