|
SageTV v7 Customizations This forums is for discussing and sharing user-created modifications for the SageTV version 7 application created by using the SageTV Studio or through the use of external plugins. Use this forum to discuss plugins for SageTV version 7 and newer. |
|
Thread Tools | Search this Thread | Display Modes |
#41
|
|||
|
|||
Thanks for adding the apps page.
Running the latest version and have 3 options on the "apps" page, bmt, sage, and sagex. BMT and sage work fine, but "sagex" produces the error below. I am not really sure what should be there, so it may be something I don't have fully installed / configured. Code:
HTTP ERROR 404 Problem accessing /sagex/. Reason: No Sage Handler Specified. Powered by Jetty:// |
#42
|
||||
|
||||
__________________
Intel Core Duo 2.5mhz, 2gb RAM Windows Home Server, Sage 7 beta 2 Hauppauge PVR-250, 1 PVR-500 MCE 1 HDHomeRun 4TB Storage, GB Network 2 MVPs, 1 HD100 & 1 HD300 |
#43
|
||||
|
||||
Quote:
The "apps" page doesn't know anything specific about webapps. Each app needs to be updated to tell it what page to go to. For example, the web ui needs to go to /sage/Home, not just /sage. I hope to get to that soon. I notified other developers of this requirement in the first post of this thread so other plugins should be adopting this as well.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#44
|
||||
|
||||
Try deleting the directories from /jetty/webapps while Sage is shut down. It should only need to be done once. After that Jetty 2.0.1 will be able to clean them up on its own.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#45
|
||||
|
||||
Thanks, it worked. I had to wait a few minutes while it recreated the directories, but all is well now.
__________________
Intel Core Duo 2.5mhz, 2gb RAM Windows Home Server, Sage 7 beta 2 Hauppauge PVR-250, 1 PVR-500 MCE 1 HDHomeRun 4TB Storage, GB Network 2 MVPs, 1 HD100 & 1 HD300 |
#46
|
|||
|
|||
I was wondering if there was a way to have: http://<server>:<port> redirect to a certain Jetty app instead of a 404 page? So instead of typing http://<server>:<port>/sage/ , I could just type http://<server>:<port> and it would forward me to http://<server>:<port>/sage/.
The web interface is my most used Jetty app, so it would be handy to be automatically redirected there. Thanks. |
#47
|
|||
|
|||
Quote:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>SageTV</title> <meta http-equiv="REFRESH" content="0;url=http://<server>:<port>/sage/"></HEAD> <BODY> </BODY> </HTML>
__________________
--Jason Server Hardware: GIGABYTE GA-EP45-UD3R, Intel Q9550 CPU 2.83GHz, 11GB RAM, 1xHDHR, 1xHVR1600, 1xHVR2250 29TB Server Storage: 1TB SSD (OS), 1TB (data), 2x6TB+2x10TB (22TB FlexRaid storage pool), 2x2TB (recordings), 1x750GB (VMs). Server Software: Win10 Pro x64 OS, SageTV 64bit v9.2.0.441, Java 1.8 u241, PlayOn, Comskip (Donator) v0.82.003, WampServer v2.5. Clients: 3xHD300s, 2xHD100, 2xPlaceshifters |
#48
|
|||
|
|||
Thanks, I had no idea about the "static" directory option. I managed to fashion my own cumbersome solution though, I copied a web app and context file from another app. Then I put an index.html file in it with the refresh, and set the path to "/".... it works.
Your way is much much simpler though, and I've switched to it Thanks. |
#49
|
|||
|
|||
Help. I am stuck. I upgraded to the latest Sage 7. Jetty and the Sage Web UI still continued to work fine. I decided to then upgrade the Jetty to the latest via the Plugins feature in S7. It installed fine, and I am able to configure it on screen, but I cannot get to the site. I don't get a jetty error in the browser, instead, it looks like the site is not up at all.
I am not sure where to look to see if it is even really running. I do see a agex-api.log with the Warning that "NO Context Was Found". Any tips to help me get the troubleshooting started would be appreciated!
__________________
HP m9040n Quad Core 2.4Ghz, Windows7 Ultimate, Ceton 4 tuner CableCard with SageDCT, 2 HDHomeRun QAM, Netgear 24 Port GiGE Switch, Linksys WRT600N Router, 3 HD200 Extenders, 2 SageTV Clients Server: SageTV 7 |
#50
|
||||
|
||||
Are you able to go to http://<server>:<port>/apps?
Try turning on Sage's debug logging (in detailed setup) and increase Jetty's log level to VERBOSE (in the Jetty plugin config screen) and see if anything looks wrong. Post it here it you'd like me to review it. Also you may have duplicate jar files if you weren't on Jetty 1.6 before installing 2.0 through the plugin manager. Please post a list of the files in your JARs folder.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#51
|
||||
|
||||
Life and Death of a Servlet
John,
I'm working on a servlet that spawns a thread. I want to make sure the thread is stopped when the Servlet instance ends. From the experiements I've done I think the servlet is instantized the first time it is needed (please correct me if I'm wrong) but I can't quite figure out when the instance ends. What are the guidelines for that? Does the instance live util Sage or Jetty stops or can the instance end before then? And more importantly, how can I catch the fact that the instance is ending so I can tell the spawned thread to stop? Thanks, Tom
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#52
|
||||
|
||||
There's a lot to cover so I'll try to keep this from getting too long and give you some pointers you can research.
Normal Java objects have no reliable way of knowing when they're being cleaned up. However, objects that implement the Servlet interface are a bit different. The Servlet interface has a destroy() method that is called by the Java web server when a servlet's lifecycle is ending. There's also an init() method for when it's being initialized. I'd recommend reading about servlet lifecycles. The servlet can be loaded either when the server starts or the first time it needs to handle a request. Check out the <load-at-startup> setting in web.xml. AFAIK, in Jetty the servlet will be destroyed either when:
Use caution with threading in servlets. One instance of a servlet services all requests. Each request runs on a new thread (or a reused thread in a pool) so the use of instance variables is generally discouraged but can be used if locking or synchronization is used correctly. Jason
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#53
|
||||
|
||||
Jason,
I understood it all up to this point: Quote:
You warn about threading in a servlet, how else do you get things done that take a long time (several minutes)? I did not see any other way other than to start a thread to handle the work so the servlet could go on it's way and handle the next request. if I do not start a thread the servlet would be unavailable for a long time. Why are instance variables discouraged, I thought that would be a preferred way of doing things? Should I make all of the variables that I want to keep track of over the life of the servlet static? I'm missing a key piece here for sure. PS. Sorry for calling you John, I was thinking JRKiwi
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#54
|
||||
|
||||
Quote:
Code:
public class MyExample { // this is available to any thread executing in // one of this object's methods private Object obj; // each thread executing within this method has // its own copy of s and methodObj public void myMethod(String s) { Object methodObj; // method logic... } } Quote:
Quote:
As I'm sure you've noticed, threading can become quite a complex topic. I would start by writing your logic without creating your own threads. Let the web server do the hard work for you.
__________________
Server: Intel Core i5 760 Quad, Gigabyte GA-H57M-USB3, 4GB RAM, Gigabyte GeForce 210, 120GB SSD (OS), 1TB SATA, HD HomeRun. Extender: STP-HD300, Harmony 550 Remote, Netgear MCA1001 Ethernet over Coax. SageTV: SageTV Server 7.1.8 on Ubuntu Linux 11.04, SageTV Placeshifter for Mac 6.6.2, SageTV Client 7.0.15 for Windows, Linux Placeshifter 7.1.8 on Server and Client, Java 1.6. Plugins: Jetty, Nielm's Web Server, Mobile Web Interface. |
#55
|
||||
|
||||
OK, lots of things to think about.
You say to let the web server do the hard work and not mess with threads. I must be missing the big picture somewhere because the way I understand it in a servlet you HAVE to start a thread to do work that will take a long time because the servlet can only process one request at a time. If the servlet is busy downloading a file for several minutes it will be unavailable to take new requests until the file download is completed. This is just does not seem right, what am I missing?
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#56
|
|||
|
|||
Quote:
The fact that a request is in your servlet will not block other requests from accessing your servlet - unless you synchronize - which is why it's very undesirable to synchronize in your servlet - it will kill the liveliness/concurrency of your web apps. With that said, in an environment like Jetty for SageTV, synchronization, though not desirable, probably isn't a big deal should your design call for it (because the max request load/max concurrent request load is so tiny - for most use cases).
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
#57
|
||||
|
||||
OK, I was under the impression that there was NEVER more than one instance of the servlet. So I CAN have one instance of the servlet busy downloading a file and jetty will create another instance to handle any new request that come in while the file is downloading.
That actually makes my life a lot easier Thank you Slugger and Jason.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#58
|
||||
|
||||
Quote:
That does not mean you need to create any additional threads; that's done automatically by Jetty. But you do need to be prepared to handle method calls from multiple threads in a thread-safe manner.
__________________
-- Greg |
#59
|
||||
|
||||
OK, so I'm back where I started. One instance that has to handle multiple requests, possibly more than one at a time.
Half my problem is that I do not know all of the correct Java/OO terminology.
__________________
Sage Server: 8th gen Intel based system w/32GB RAM running Ubuntu Linux, HDHomeRun Prime with cable card for recording. Runs headless. Accessed via RD when necessary. Four HD-300 Extenders. |
#60
|
|||
|
|||
To simplify:
Each request to Jetty generates a unique HttpServletRequest and HttpServletResponse object (how those are built, be it a pool, etc. is irrelevant). Those two objects are passed to your servlet in its own thread. So your servlet will be used in all active request threads simultaneously and there will only ever be exactly one instance of your servlet, which is shared among all active request threads. This is the reason why if your servlet has instance or static vars then they must be synchronized. And synchronization is not ideal in web apps with high volumes of traffic because when you synchronize then (in a high level view) only one request can be serviced at a time - the others must wait their turn. However, as I said above, in our (jetty apps for SageTV) little universe you can basically ignore this design goal/issue because at its busiest you're probably talking 2-3 simultaneous connections at once, which is not going to cause any kind of issues unless you do some kind of long computation inside a synchronized() block. To me, a servlet should return a response to the browser in sub-second time so synchronized() blocks of code are fine (I even do it in my SJQ code quite liberally to protect against simultaneous modification of the SJQ task queue by multiple task clients), but your servlet should complete and return the response as quickly as possible otherwise users get a sense that the web site is "hung", etc. Ultimately, I guess the lesson here is that J2EE app design and implementation requires a bit of planning. I think Jason mentioned reading up on the servlet lifecycle? Couldn't agree more. The more you understand about the details of a J2EE app, the easier it becomes to identify and solve these kinds of issues up front - before they become bigger problems.
__________________
Twitter: @ddb_db Server: Intel i5-4570 Quad Core, 16GB RAM, 1 x 128GB OS SSD (Win7 Pro x64 SP1), 1 x 2TB media drive Capture: 2 x Colossus STB Controller: 1 x USB-UIRT Software:Java 1.7.0_71; SageTV 7.1.9 Clients: 1 x HD300, 2 x HD200, 1 x SageClient, 1 x PlaceShifter Plugins: Too many to list now... |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Plugin: SageTV Web Interface V2 for Jetty | jreichen | SageTV Customizations | 256 | 02-09-2014 08:05 AM |
Plugin: Jetty Starter 1.6 | jreichen | SageTV Customizations | 122 | 09-07-2012 06:48 PM |
error message with web server plugin | edgley | SageTV Customizations | 3 | 01-15-2006 11:32 AM |
Sage Web Server and existing web server compatibilty? | Brent94Z | SageTV Customizations | 6 | 01-18-2005 11:29 AM |