Package io.sentry

Class Session


  • public final class Session
    extends java.lang.Object
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Session.State
      Session state
    • Constructor Summary

      Constructors 
      Constructor Description
      Session​(@NotNull Session.State status, @NotNull java.util.Date started, @Nullable java.util.Date timestamp, int errorCount, @Nullable java.lang.String distinctId, @Nullable java.util.UUID sessionId, @Nullable java.lang.Boolean init, @Nullable java.lang.Long sequence, @Nullable java.lang.Double duration, @Nullable java.lang.String ipAddress, @Nullable java.lang.String userAgent, @Nullable java.lang.String environment, @NotNull java.lang.String release)  
      Session​(@Nullable java.lang.String distinctId, @Nullable User user, @Nullable java.lang.String environment, @NotNull java.lang.String release)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      @NotNull Session clone()
      Ctor copy of the Session
      void end()
      Ends a session and update its values
      void end​(@Nullable java.util.Date timestamp)
      Ends a session and update its values
      int errorCount()  
      @Nullable java.lang.String getDistinctId()  
      @Nullable java.lang.Double getDuration()  
      @Nullable java.lang.String getEnvironment()  
      @Nullable java.lang.Boolean getInit()  
      @Nullable java.lang.String getIpAddress()  
      @NotNull java.lang.String getRelease()  
      @Nullable java.lang.Long getSequence()  
      @Nullable java.util.UUID getSessionId()  
      @Nullable java.util.Date getStarted()  
      @NotNull Session.State getStatus()  
      @Nullable java.util.Date getTimestamp()  
      @Nullable java.lang.String getUserAgent()  
      void setInitAsTrue()
      Used for migrating the init flag when an session is gonna be deleted.
      boolean update​(@Nullable Session.State status, @Nullable java.lang.String userAgent, boolean addErrorsCount)
      Updates the current session and set its values
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Session

        public Session​(@NotNull
                       @NotNull Session.State status,
                       @NotNull
                       @NotNull java.util.Date started,
                       @Nullable
                       @Nullable java.util.Date timestamp,
                       int errorCount,
                       @Nullable
                       @Nullable java.lang.String distinctId,
                       @Nullable
                       @Nullable java.util.UUID sessionId,
                       @Nullable
                       @Nullable java.lang.Boolean init,
                       @Nullable
                       @Nullable java.lang.Long sequence,
                       @Nullable
                       @Nullable java.lang.Double duration,
                       @Nullable
                       @Nullable java.lang.String ipAddress,
                       @Nullable
                       @Nullable java.lang.String userAgent,
                       @Nullable
                       @Nullable java.lang.String environment,
                       @NotNull
                       @NotNull java.lang.String release)
      • Session

        public Session​(@Nullable
                       @Nullable java.lang.String distinctId,
                       @Nullable
                       @Nullable User user,
                       @Nullable
                       @Nullable java.lang.String environment,
                       @NotNull
                       @NotNull java.lang.String release)
    • Method Detail

      • getStarted

        @Nullable
        public @Nullable java.util.Date getStarted()
      • getDistinctId

        @Nullable
        public @Nullable java.lang.String getDistinctId()
      • getSessionId

        @Nullable
        public @Nullable java.util.UUID getSessionId()
      • getIpAddress

        @Nullable
        public @Nullable java.lang.String getIpAddress()
      • getUserAgent

        @Nullable
        public @Nullable java.lang.String getUserAgent()
      • getEnvironment

        @Nullable
        public @Nullable java.lang.String getEnvironment()
      • getRelease

        @NotNull
        public @NotNull java.lang.String getRelease()
      • getInit

        @Nullable
        public @Nullable java.lang.Boolean getInit()
      • setInitAsTrue

        @Internal
        public void setInitAsTrue()
        Used for migrating the init flag when an session is gonna be deleted.
      • errorCount

        public int errorCount()
      • getSequence

        @Nullable
        public @Nullable java.lang.Long getSequence()
      • getDuration

        @Nullable
        public @Nullable java.lang.Double getDuration()
      • getTimestamp

        @Nullable
        public @Nullable java.util.Date getTimestamp()
      • end

        public void end()
        Ends a session and update its values
      • end

        public void end​(@Nullable
                        @Nullable java.util.Date timestamp)
        Ends a session and update its values
        Parameters:
        timestamp - the timestamp or null
      • update

        public boolean update​(@Nullable
                              @Nullable Session.State status,
                              @Nullable
                              @Nullable java.lang.String userAgent,
                              boolean addErrorsCount)
        Updates the current session and set its values
        Parameters:
        status - the status
        userAgent - the userAgent
        addErrorsCount - true if should increase error count or not
        Returns:
        if the session has been updated
      • clone

        @NotNull
        public @NotNull Session clone()
        Ctor copy of the Session
        Overrides:
        clone in class java.lang.Object
        Returns:
        a copy of the Session